![]() |
![]() |
switchAnother flow control command |
|||
Usage | |||
|
|||
Description | |||
The switch command is based on the standard C 'switch' keyword.
It executes conditionally groups of commands chosen from
a larger set of command groups. First <expression> is evaluated (<expression> is any arithmetic or string expression). Then the 'match','regexp','case' and 'default' labels are evaluated sequentially in the order of appearance. case(<value>)[:]<command> The <value> is evaluated and is compared against the result of <expression>. The comparison is case insensitive (if the values are strings). If <value> is equal to <expression> then <command> is executed. Please note that <command> must be either a single instruction or an instruction block enclosed in braces. If <command> contains a break statement inside or if break is specified just after the <command> then the execution of the switch is terminated otherwise the nex label is evaluated. match(<value>)[:]<command> The <value> is expected to be a wildcard expression (containing '*' and '?' wildcards) that is matched against <expression>. If there is a match (a complete case insensitive match!) then the related <command> is executed. brea is treated just like in the case label. regexp(<value>)[:]<command> The <value> is expected to be a complete standard regular expression that is matched agains <expression>. If there is a match (a complete case insensitive match!) then the related <command> is executed. brea is treated just like in the case label. default[:]<command> The default label is executed unconditionally (unless there was a previous label that terminated the execution with break). |
|||
Syntax Specification | |||
|
|||
Examples | |||
# Try to change the 1 below to 2 or 3 to see the results
|