switch(EXPR, ...)
EXPR
| an expression that evaluates to a number or a character string |
...
| the list of alternatives, given explicitly |
switch evaluates EXPR if the value is an integer between
1 and nargs()-1 then the corresponding element of ... is
evaluated and the result returned.
If EXPR returns a character string then that string is used to
match the names of the elements in .... If there is an exact match
then that element is evaluated and the result returned.