Programmer Guide/Command Reference/IF: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
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>[[Programmer_Guide/Concepts/Conditional_Expressions|condition]]</var> singlecommand
  IF [[Programmer_Guide/Concepts/Conditional_Expressions|<var>condition</var>]] singlecommand
  IFNOT <var>[[Programmer_Guide/Concepts/Conditional_Expressions|condition]]</var> singlecommand
  IFNOT [[Programmer_Guide/Concepts/Conditional_Expressions|<var>condition</var>]] singlecommand


The second allows conditional execution of multiple commands within a block:
The second allows conditional execution of multiple commands within a block:

Revision as of 16:52, 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
   &hellip:
ELSE IF condition2 THEN
   &hellip:
ELSE IFNOT conditionn THEN
   &hellip:
ELSE
   &hellip:
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.

Navigation menu

Personal tools