switch
expression
case
expression
statementList
case
expression
statementList
...
default
statementList
end
switch
switch x case 1 put "x is 1" case 2 put "x is 2" case 3 put "x is 3" default put "x is something else" end switch
The switch
structure evaluates the specified expression and executes the series of statements underneath the corresponding case
clause with the same value. If no corresponding case
clause is found, the switch
structure executes the series of statements underneath the default
clause, if it exists.