Programmer Guide/Command Reference/ELSE: Difference between revisions
From STX Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
The <code>ELSE</code> statement is part of the <code>IF</code> | The <code>ELSE</code> statement is part of the <code>[[Programmer_Guide/Command_Reference/IF|IF]]</code> … <code>THEN</code> … <code>ELSE IF</code>… <code>ELSE</code> … <code>[[Programmer_Guide/Command_Reference/END|END]]</code> command. | ||
{{:Programmer_Guide/Command_Reference/IF}} |
Latest revision as of 14:23, 25 April 2014
The ELSE
statement is part of the IF
… THEN
… ELSE IF
… ELSE
… END
command.
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 the IF
clause is mandatory, all other clauses are optional. 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.
Neither the condition nor the singlecommand
should contain the string THEN
. If either does, in most cases STx will amazingly mistake the whole command for an ill-formed IF
… THEN
… END
block.