image\gflag9_shg.gif

Tutorial Course - Hole #9

 

In this code example Switch is used to conditionally select one of several options.

Each case statement block is composed of three parts; a case statement followed by a number, a series of one or more statements and the break command. If the number behind the case statement matches the number behind the switch statement, then the case block is executed. Once the correct message has been displayed, break terminates the case block and transfers control to the EndSwitch statement.

FYI, this structure is sometimes called Select. It is documented in the WIL Reference under both names; Switch and Select.