Programmer Guide/Command Reference/IF: Difference between revisions
From STX Wiki
Jump to navigationJump to search
(→IF) |
(→IF) |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
There are two forms of the <code>IF</code> syntax. The first allows the conditional execution of one command: | |||
IF <var>condition</var> command | |||
The second allows conditional execution of multiple command within a block: | |||
IFNOT <var>condition</var> command | |||
Conditional execution of a command. For more information on conditions see [[Programmer Guide/Command Reference_Intro/condition|condition]]. | Conditional execution of a command. For more information on conditions see [[Programmer Guide/Command Reference_Intro/condition|condition]]. | ||
IF condition THEN | |||
... | |||
ELSE IF condition THEN | |||
... | |||
ELSE IFNOT condition THEN | |||
... | |||
ELSE | |||
... | |||
END | |||
Conditional execution of command blocks. Only the <code>IF</code> clause is necessary, all others are optional. Both command forms <code>IF</code> and <code>IFNOT</code> can be used. Empty clauses (without commands) are allowed. The last clause must be closed with <code>[[Programmer Guide/Command Reference/END|END]]</code>. For more information on conditions see [[ | Conditional execution of command blocks. Only the <code>IF</code> clause is necessary, all others are optional. Both command forms <code>IF</code> and <code>IFNOT</code> can be used. Empty clauses (without commands) are allowed. The last clause must be closed with <code>[[Programmer Guide/Command Reference/END|END]]</code>. For more information on conditions see [[Command Reference Intro/Conditional Expressions|condition]]. |
Revision as of 21:17, 22 March 2011
There are two forms of the IF
syntax. The first allows the conditional execution of one command:
IF condition command
The second allows conditional execution of multiple command within a block:
IFNOT condition command
Conditional execution of a command. For more information on conditions see condition.
IF condition THEN ... ELSE IF condition THEN ... ELSE IFNOT condition THEN ... ELSE ... END
Conditional execution of command blocks. Only the IF
clause is necessary, all others are optional. Both command forms IF
and IFNOT
can be used. Empty clauses (without commands) are allowed. The last clause must be closed with END
. For more information on conditions see condition.