Switch case in protected scope exception resolution

Source: Internet
Author: User
Tags switch case

Sunny, why early in the morning to give me a switch error. Exception hint: switch case in protected scope, this is completely OK when you have only one line of code in the switch's cases. If you want to write multiple lines of code in a case. This time the compiler is not calm. It will report switch case in protected scope error.



Share the switch case in protected scope exception resolution,

Switch will report the switch case in protected scope error. The compiler is telling you to stop it quickly. So you switch is developed to let me write a line of code?

Of course not, if you have this question stating that your C foundation is not solid enough. The prototype of switch:

Switch (XXX) {

Case Xxx:

{

Xxxx

}

break;

default:

break;

}


Let's continue to look at the prototype to write each case plus a {} compiler will you calm down?


Ok. You can see that there are no errors. After all, it's the basics. Silently go back to review.




Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Switch case in protected scope exception resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.