Contents | Index | < Browse | Browse >
DOCASE, CASE, BREAK, ENDCASE
================================================================
This command structure is like a multiple IF. It lets you choose
easily between more than 1 choices. The format is as follows:
DOCASE Argument
CASE Operator Argument
(commands....)
BREAK
CASE Operator Argument <- you may have many case statements
CASE Operator Argument
(commands....)
BREAK
ENDCASE
Example :
TestVar = "TEST"
DoCase $TestVar
Case = "Wrong choice"
Case = "Another wrong choice"
Say "This is never happenn"
BREAK
Case = "TEST"
Say "Yes, this is the one!n"
BREAK
EndCase
The above should print the word "Yes, this is the one!"
You can have as many case statements as you want.
These are OPERATOR you can use (same as IF and WHILE).
You can have DoCase within DoCase etc...
When docase finds a case which is true, it will start executing
until it encounters an ENDCASE or a BREAK. - like in a C program
This means that you can have multiple case arguments in a row (as
is done above in the first 2 cases), and the code following will be
executed if any one of them is true.