186
14.4.3.2 Select-Case Statements
The Select Case is a specialized form of the If-Then-Else statement. It allows multiple comparisons to values.
The Syntax is as follows:
Select Case <Expression>
[Case <evaluation>]
[Statements]
[Case Else]
[Statements]
End Select
Syntax description:
Select Case
Must be used to begin the statement
< Expression >
Required. This is the controlling expression. The result of evaluating the expression is
used as a test in the Case expressions.
Case
Must precede the statements that evaluate the results of the Select Case <Expression>
< evaluation >
This is the controlling statement for each Case. It is compared to the results of the Select
Case <Expression>. If it evaluates to TRUE then the statements below it are executed. If
fit evaluates to FALSE then the macro jumps to the next Case or Case Else.
[Statements]
Statements to execute when the evaluation is TRUE.
Case Else
Must precede the statements to execute if none of the Cases evaluates to TRUE.
End Select
Must be used to end a Select Case.
14.4.4 Reiterative Statements
Reiterative statements control loops and repetitive tasks depending on conditions. There are two types of reiterative
statements.
14.4.4.1 For-Next Statements
The For-Next construction is for stepping through a fixed number of iterations. A variable is used as a counter to track
progress and test for ending conditions. Use this for fixed execution counts.
The Syntax is as follows:
For <Counter> = <StartValue> To <EndValue> [Step <Stepvalue> ]
or
For <Counter> = <StartValue> Down <EndValue> [Step <Stepvalue> ]
[Statements]
Next [counter]
Syntax description:
For
Must be used to begin the statement
< Counter >
Required. This is the controlling variable. The result of evaluating the variable is used as
a test for completion.
<StartValue>
Required. The < Counter >s initialized value.
To or Down
This determines if the Step control increments or decrements the <Counter>. “To”
increments <Counter> by <Stepvalue>. “Down” decrements <Counter> by <Stepvalue>.
<EndValue>
Required. The test point. If the < Counter >is greater than this value, the macro exits the
loop.
Step
Optional keyword. Specifies that a <StepValue> other than one is to be used.
<StepValue>
The value that < Counter > is changed every loop. If [Step <Stepvalue> ] keywords are
omitted the step value defaults to 1.
[Statements]
Statements to execute when the evaluation is TRUE. For-Next loops may be nested.
Next
Must precede the statements to execute if none of the Cases evaluates to TRUE.
[counter]
Optional < Counter > name. This is used when nesting For-Next loops.
Summary of Contents for MMI-1500
Page 2: ...ii...