[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
SELECT Case Structure
SELECT CASE expression
CASE testlist
.
. [statements]
.
[CASE testlist
.
. [statements]
.]
[CASE ELSE
.
. [statements]
.]
[EXIT SELECT]
END SELECT
Compares an expression against one or more values and directs
execution flow in accordance with the result.
expression An expression of any type.
testlist A comma-delimited list of expressions (see further
description, below) that test the value of expression.
--------------------------------------------------------------------------
Notes: The elements of a given testlist argument are implicitly
ORed. Therefore, the statements following CASE testlist
are executed if any member of testlist is true. Following
execution of those statements, control passes to the first
statement following END SELECT.
The SELECT CASE structure may include any number of CASE
testlist clauses but must include at least one. All CASE
testlist clauses must appear before the optional CASE ELSE
clause.
The statements following CASE ELSE are executed if all
elements in all CASE testlist clauses are false.
The optional EXIT SELECT provides an alternative exit from
the CASE structure but does not end its definition; END
SELECT is still required.
The testlist argument may include the following kinds of
tests: equality, inequality, greater than, less than, and
range. Examples of each are as follows:
CASE 100
CASE <> "Hi Mom"
CASE > -5
CASE < 2E15
CASE 5 TO 10
Note that no operator is required for the equality test.
The SELECT CASE structure is equivalent to a set of nested
IF/THEN/ELSE statements but produces more readable source
code.
See Also:
IF
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson