Chapter 6 RAPID!
Commands
174 WCDMA Options Version 6.20
SELECT CASE, CASE ELSE, END
SELECT
IF (i <= 0) THEN
PRINT "Not a positive number"
ELSEIF (i MOD 2 = 0) THEN
PRINT "Even"
ELSE
PRINT "Odd"
END IF
Syntax
SELECT CASE varName
CASE varExp [ { , varEXP } ] instruc-
tion
[ { CASE varExp [ { , varEXP } ]
instruction } ]
CASE ELSE instruction
END SELECT
Parameters
varName is a valid variable name,
varEXP are expressions of the same type as varName,
instruction are valid RAPID! commands.
Description
Performs one of several blocks of commands, depending
on the value of
varName.
If
varName is identical with any one of the varExp
expressions, the commands following that
CASE state-
ment will be performed until the subsequent
CASE or the
END SELECT command is reached. The program will
then resume with the command following the
END
SELECT
statement.
If
varName is identical with several varExp, only the
first one found will be executed.
Several
varExp may be used in the same CASE com-
mand; they need to be separated by commas.
Examples
SELECT CASE Day
CASE 1: PRINT "MONDAY"
CASE 2: PRINT "TUESDAY"
CASE 3: PRINT "WEDNESDAY"
CASE 4: PRINT "THURSDAY"
CASE 5: PRINT "FRIDAY"
CASE 6, 7: PRINT "WEEKEND"
CASE ELSE
PRINT "Data out of range"
END
END SELECT