The switch statement is a specialized form of conditional.
switch(intvar*2) { case 0: print('case0'); break; case 1+1: print('case2'); break; default: print('default'); break; }This statement prints "case0" if the value of intvar*2 is 0, "case2" if the value of intvar*2 is 2, and "default" otherwise. The default is optional. The expression inside the parentheses switch(...) must be of base type, and the expressions following the case keyword must have the same base type.
switch(intvar*2) { case 0: print('case0'); case 1+1: print('case2'); break; default: print('default'); break; }