Using Control Structures in Scripts

The CLI supports the control structures described in the following sections.

Conditional Execution

IF (<expression>) THEN
<statements>
ELSE
<statements>
ENDIF

The expression must be enclosed in parentheses.

Loop While Condition is TRUE

WHILE (<expression>) DO
	<statements>
ENDWHILE

The expression must be enclosed in parentheses.

Nesting is supported up to five levels. The Ctrl-C key combination can be used to break out of any While loop(s).

The operators mentioned in Using Operators can be used in an expression in the set var command or in an IF or WHILE condition.

If there is incorrect nesting of an IF condition or WHILE loop, an error message appears. If a user tries to type more than five WHILE loops or five IF conditions, an error message appears. Breaking out of any number of WHILE loops always clears the WHILE condition.

Comments can be inserted by using the number sign (#).