switch (expression) { case value: instructions...  break; default: instructions... break; }

 LC  The switch statement allows for branching on multiple values of a variable or expression. The expression is evaluated and compared with the case values. If it matches any of the case values, the instructions following the colon are executed, until a break statement is found. Every case statement must be followed by instructions and a break statement; empty case statements are not allowed. If the expression does not match any of the case statements, and if there is a default statement, the instructions following default: are executed, otherwise the switch statement ends.


var choice = 0;
case 0:
printf("Zero! ");
case 1:
printf("One! ");
case 2:
printf("Two! "); break;
printf("None of them! "); break;

See also:

if, while, goto, break, continue, comparisons ► latest version online