Programmer Guide/Command Reference/IF: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
Line 2: Line 2:
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:


  IF <var>condition</var> command
  IF <var>condition</var> singlecommand
The second allows conditional execution of multiple command within a block:
  IFNOT <var>condition</var> singlecommand
  IFNOT <var>condition</var> command
The second allows conditional execution of multiple commands within a block:
 
Conditional execution of a command. For more information on conditions see [[Programmer Guide/Command Reference_Intro/condition|condition]].
 
  IF condition THEN
  IF condition THEN
     ...
     ...
Line 17: Line 14:
     ...
     ...
  END
  END
 
Note that only <code>IF</code> clause mandatory, all other clauses are optional. Both command forms <code>IF</code> and <code>IFNOT</code> can be used. Empty clauses (i.e., 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|Conditional Expressions]].
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:19, 22 March 2011

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 condition THEN
   ...
ELSE IF condition THEN
   ...
ELSE IFNOT condition 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 END. For more information on conditions see Conditional Expressions.

Navigation menu

Personal tools