BEE Script: switch (value)
{
case value:
statement;
...
[break;]
[case value:
statement;
...
[break;]]
...
[default:
statement;
...
[break;]]
}
BEE Tag: <beeswitch "value">
<beecase "value">
tag
...
[<beebreak>]
[<beecase "value">
tag
...
[<beebreak>]]
...
[<beecase>
tag
...
[<beebreak>]]
</beeswitch>
Note 1: In BEE Tag form, "case" without a value is the "default" case. (In BEE Script form, the alias "default" will be translated to a "case" command with no parameter.)
Note 2: All contents (scripts, HTML codes or text), if any, between "switch" and the first "case" will be ignored.
The "switch" command specify a value for matching with the one in the "case" command. If one is matched, the block specifies after the "case" command will be executed until a "break" command is encountered, then exist the "switch" block.
If there is no "break" statement in the block of matching "case" value, the execution will fall through to the next block until a "break" command is executed. So it is possible that multiple blocks are executed before the exist of the "switch" block.
If none of the "case" command got a value matching the one in the "switch" command, the "default" block if exists will be executed. If the "default" block is not specified, the whole "switch" block will be skipped with no execution at all.
Example:
display "Please wear ";
switch ("{patron}")
{
case "woman":
case "girl":
display "skirt";
break;
case "man":
display "tie and ";
// Fall through
case "boy":
display "shirt";
break;
default:
display "properly";
}
|