CASE
Command: #case {conditional} {arguments}
The case command must be used within the #switch command. When the
conditional argument of the case command matches the conditional
argument of the switch command the body of the case is executed.
When comparing strings both the switch and case arguments must be
surrounded in quotes.
Example:
#function {reverse_direction}
{
#switch {"%1"}
{
#case {"north"} {#return south};
#case {"east"} {#return west};
#case {"south"} {#return north};
#case {"west"} {#return east};
#case {"up"} {#return down};
#case {"down"} {#return up}
}
}
This function returns the reverse direction. @reverse_direction{north}
would return south.
Related: default, statements and switch.
|