![]() ![]() |
|
CASEThe CASE statement allows the programmer to execute a particular sequence of instructions based upon the results of a series of test expressions.
COMMAND SYNTAXBEGIN CASE
SYNTAX ELEMENTSThe CASE structure is bounded by the BEGIN CASE and END CASE statements. Within this block, an arbitrary number of CASE expression statements may exist followed by any number of jBC statements. The expression should evaluate to a TRUE or FALSE result. At execution time, each expression is evaluated in order. If the expression returns a TRUE result, then the statements beneath it are executed. On completion of the associated statements, execution will resume at the first statement following the END CASE.
NOTESA default action (to trap error conditions for instance) may be introduced by using an expression that is always TRUE, such as CASE 1. This should always be the last expression in the CASE block.
EXAMPLE
A single comment is printed depending on the value of A. Note that if A is not 1 then the default CASE 1 rule will be executed as a "catch all". |