IF

From STX Wiki
Jump to navigationJump to search

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 IFTHENEND block.

Navigation menu

Personal tools