Programmer Guide/Command Reference/IF: Difference between revisions
From STX Wiki
Jump to navigationJump to search
m (Text replace - "Command_Reference_Intro" to "Concepts") |
No edit summary |
||
Line 7: | Line 7: | ||
IF <var>[[Programmer_Guide/Concepts/Conditional_Expressions|condition<sub>1</sub>]]</var> THEN | IF <var>[[Programmer_Guide/Concepts/Conditional_Expressions|condition<sub>1</sub>]]</var> THEN | ||
... | ... | ||
ELSE IF <var>condition<sub>2</sub></var> THEN | ELSE IF <var>[[Programmer_Guide/Concepts/Conditional_Expressions|condition<sub>2</sub>]]</var> THEN | ||
... | ... | ||
ELSE IFNOT <var>condition<sub>n</sub></var> THEN | ELSE IFNOT <var>[[Programmer_Guide/Concepts/Conditional_Expressions|condition<sub>n</sub>]]</var> THEN | ||
... | ... | ||
ELSE | ELSE |
Revision as of 14:44, 15 April 2014
There are two forms of the IF
syntax. The first allows the conditional execution of one command:
IF condition singlecommand IFNOT condition singlecommand
The second allows conditional execution of multiple commands within a block:
IF condition1 THEN ... ELSE IF condition2 THEN ... ELSE IFNOT conditionn THEN ... ELSE ... END
Note that only IF
clause mandatory, all other clauses are optional. Both command forms IF
and IFNOT
can be used. Empty clauses (i.e., clauses without commands) are allowed. The last clause must be closed with an END
statement. For more information on conditions see Conditional Expressions.