Process control -switch

2.switch statement
switch (expression) {
Case Value 1: // case corresponds ==
statement block. 1;
BREAK;
Case 2 values:
a block of statements 2;
BREAK;
.......
default:
statement block n-
}

Precautions:
1) the value of the expression or a character string is preferably plastic!
2) Do not forget the break statement! Switch statement to jump out! After each case statement with BREAK
3) If a case statement and did not take back the statement block, then that block the contents of this statement is the same case!
4) the rear case block need not be enclosed in {}

Guess you like

Origin www.cnblogs.com/xiaowie/p/11540276.html