Conditional Logic
Conditional logic commands enable a procedure to test the value of variables or expressions and then branch to appropriate routines.
Command | Description |
---|---|
Begin Case Case statement End Case | Tests a series of conditions (cases). When any one is met, the statements dependent on that condition are executed. All subsequent condition tests (cases) are skipped. |
If conditional expression | Same as single-line If statement, except that the entire statement is evaluated as an expression, returning only one of two values. |
If...Then...Else statements | Performs single-line or multiple-line logic. If not single-line, statements for both branches must be delimited with End. Multi-line conditional logic syntax is applicable to all conditional statements (such as Read or Locate statements). |
Null statement | A no-op. Used if a statement is called for, but no action is desired (example: If … Then Null Else …). |
On...GoSub statement | Branches, based on an index, to a series of labels to multiple locations. When the subroutine returns, control returns to the statement following this one. |
On...GoTo statement | Branches, based on an index, to a series of labels to multiple locations. |
Until/While statement | Establishes exit conditions for a loop created by the Loop … Repeat or the For…Next statements. |