A switch statement allows a TE program to make a decision based on the value of an expression. Several choices are specified, when a matching choice is found, the following statements are executed. The syntax of the switch statement is as follows:
switch ( expr )
{ case expr : statement_block
{ case expr : statement_block …
{ default : statement_block } } }
endswitch
After the switch statement there are zero or more case statements followed by an optional default statement. The way it works is that the value of the switch expr is evaluated then whichever case expr matches this value has its statement_block executed then control jumps to the endswitch statement. If none of the case expr values match then the default statement_block is executed if one is present.