case variable
[ anything1 [list of commands 1]
anything2 [list of commands 2] ]
Checks if the first argument variable is equal to any of
the anythings in the list. If it is equal, the corresponding
[list of commands] is executed and control skips to the end of the case
statement. A case statement can often be used in place of nested ifelse statements.
If nothing matches, no [lists of commands] are executed and
control skips to the end of the case statement. You can use true
as one of your anythings as a default case. Note: the first input can be
an expression as well as a variable.
Examples:
case temperature [ "cold" [show "boy, it's cold!"] "warm" [show "mmmm. nice."] "hot" [show "wow, it's hot!"] ]
Related commands:
if ifelse
|