[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SELECT                   Case Structure

 SELECT CASE expression
 CASE testlist
 .
 . statements
 .
 [CASE testlist
 .
 . statements
 .]
 [CASE ELSE
 .
 . statements
 .]
 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 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 IS = 100
                    CASE IS <> "Yomama"
                    CASE IS > -5
                    CASE IS < 2E15
                    CASE 5 TO 10

                Note that the = operator is optional for the equality
                test, and that the keyword IS must be used before any
                relational operator. In the range test, the smaller of the
                two values must appear before the keyword TO.

                The SELECT CASE structure is equivalent to a set of nested
                IF/THEN/ELSE statements but produces more readable source
                code.

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson