The switch command has several nested decision structures. It allows you to go directly to a block of commands, depending on the value of a check variable. For more information see commands break and case
Note that the code in figure 1 is probably wrong, since it will print both messages. To avoid the all case block to the executed after the first switch condition coincides one case, you must "break" the case. That is, you must insert as the last command of each case block the command break.