IF ... THEN ... ELSE |
Top Previous Next |
Use for conditional code branching.
Syntax <if_then_else> ::= IF (<condition>) THEN <compound_statement> [ELSE <compound_statement>;
The conditional IF ... THEN statement is used for branching code. The condition needs to be inside parenthesis.
If the condition tests to be False, the THEN-clause will nog be executed. If there's an ELSE-clause available and the condition evaluates to False (or "unknown"), the ELSE-clause will be executed.
You can chain IF ... THEN ... ELSE statements, as in IF ... THEN ... ELSE statements to test for multiple conditions and branch depending on the outcome.
Example EXECUTE UDSBLOCK AS BEGIN I = 1; WHILE (i < 10) DO BEGIN i = i + 1; IF (Math.Mod(i, 2) = 0) /* check for even numbers, skip the loop if even */ THEN CONTINUE; ELSE BEGIN /* do stuff */ END END END |