1switch (n)
2{
3 case 1: // code to be executed if n = 1;
4 break;
5 case 2: // code to be executed if n = 2;
6 break;
7 default: // code to be executed if n doesn't match any cases
8}
1switch(expression) {
2 case constant-expression :
3 statement(s);
4 break; //optional
5 case constant-expression :
6 statement(s);
7 break; //optional
8
9 // you can have any number of case statements.
10 default : //Optional
11 statement(s);
12}
13