Programmer Guide/Command Reference/IF: Difference between revisions

From STX Wiki
Jump to navigationJump to search
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
==IF==
There are two forms of the <code>IF</code> syntax. The first allows the conditional execution of one command:


There are two forms of the <code>IF</code> syntax. The first allows the conditional execution of one command. The second allows conditional execution of multiple command within a block.
IF <var>condition</var> command
 
The second allows conditional execution of multiple command within a block:
<code>IF <var>condition command</var></code>
IFNOT <var>condition</var> command
 
<code>IFNOT <var>condition command</var></code>


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]].


<code>IF condition THEN</code>
IF condition THEN
 
    ...
<code>...</code>
ELSE IF condition THEN
 
    ...
<code>ELSE IF condition THEN</code>
ELSE IFNOT condition THEN
 
    ...
<code>...</code>
ELSE
 
    ...
<code>ELSE IFNOT condition THEN</code>
END
 
<code>...</code>
 
<code>ELSE</code>
 
<code>...</code>
 
<code>END</code>


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 [[Programmer Guide/Command Reference/condition|condition]].
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.

Navigation menu

Personal tools