Switch Case 和 If Else

 When more than three or more is preferably used to select Switch Case:
    syntax is as follows:

  

switch(expression){
    case value :
       // statement
       break; 
    case value :
       // statement
       break; 
    // You can have any number of case statements
    default : 
       // statement
}

  note:

    When it encounters a break statement, switch statement is terminated. The program jumps to the back of the switch statement executes the statement. case statement does not have to contain a break statement. If there is no break statement occurs, the program will continue with the next case statement until a break statement appears

Guess you like

Origin www.cnblogs.com/irobotzz/p/12196667.html