| CAPTURING ON | Index Level | CASING |
| Syntax |
BEGIN CASE
CASE logical.expression {statement{s}} . CASE logical.expression {statement{s}} . . END CASE |
| Category | BASIC |
| Type | Statement |
| Description |
delineates a conditional case construct.
Only the statements following the first "true" case statement are executed. Upon completion of these statements program execution continues immediately following the "end case" statement. If all "case" statements evaluate false, program execution is continued at the first statement after the "end case". A "case 1" statement always evaluates true and is used as the last case statement to be processed only when all previous case statements evaluate to false. The "case" statement is equivalent to nested "if" expressions as follows: if logical.expression then {statement{s}} end else if logical.expression then {statement{s}} end end The statements between "case" statements are executed if the expression associated with the case evaluates to true. If the expression evaluates to false, the statements are not executed. |
| Options | |
| See Also | statements & functions END CASE IF MATCH logical expressions BEGIN CASE branching |
| Example |
begin case
* check for operators response case response = "p" printer on case response = "s" echo off case 1 crt "response must be 'p' or 's'" end case In this example, if the response is "p", the "printer on" statement is issued. The program would then branch to the next statement after "end case". The "case 1" is executed only if response is neither "p" nor "s". |
| Warnings | |
| Compatibility | D3 7.0 AP R83 |
| CAPTURING ON | Index Level | CASING |