IF THEN [ELSIF] [ELSE] ENDIF action


Function
Conditional execution of actions.
Declaration

IF expression1 THEN
...; actions 1
[ELSIF expression2 THEN]
...; actions 2
[ELSIF expression3 THEN]
...
; actions 3
[ELSE]
...; actions 4
ENDIF

Parameters
expression1, expression2, expression3inExpressions of BOOL type.
Description
Expression1, expression2, ... are evaluated in successive steps. When one of the expressions gains the value TRUE, then actions following this expression are to be executed up to the nearest ELSIF, ELSE or ENDIF. If any of the expressions does not gain the value TRUE, then the sequence of actions between the commands ELSE - ENDIF (they are optional) is to be executed.

If some of the expressions expression1, expression2, ... gains an invalid value, the action generates the error _ERR_EXPRESSION_STATUS.

Note
An equivalent of the action IF THEN [ELSIF] [ELSE] ENDIF may be coded using the conditional jump IF GOTO and the action GOTO. The advantage of the action IF THEN [ELSIF] [ELSE] ENDIF is that there is no need to create labels and their names (it increases the code transparency).

Related pages:

0 komentárov

Nie ste prihlásený. Akékoľvek zmeny, ktoré vykonáte, sa označia ako anonymné. Ak už máte svoj účet, pravdepodobne sa budete chcieť prihlásiť .