
Chapter 11 Flow Control Statements
11-19
SELECT CASE (Statement)
Function
Executes a plural condition decision.
Format
SELECT CASE <Expression>
CASE <Item>[,<Item>...]
:
[CASE ELSE]
END SELECT
Explanation
This statement executes a series of instructions after CASE if the value of
<Expression> matches <Item> of the CASE statement.
An arithmetic expression or character string can be designated for
<Expression>.
A variable, a constant, an expression or a conditional expression can be
designated for <Item>.
A conditional expression can be designated as follows.
• <Arithmetic expression 1> TO < Arithmetic expression 2>
The result of <Expression> is checked if it is <Arithmetic expression 1> or
higher, or if it is <Arithmetic expression 2> or lower.
• This statement cannot be used in the case of a character string.
IS <Comparison operator><Arithmetic expression>
The result of <Expression> and the value of <Arithmetic expression> are
compared.
In the case of a character string, <Comparison operator> is “ = ”.
A CASE ELSE statement is executed if all CASE statements are not satisfied.
A CASE ELSE statement must be put before an END SELECT statement.
Related Terms
IF-END IF
Kommentare zu diesen Handbüchern