Using NS3000/iX Network Services (36920-90008)

Chapter 8 193
NetCI
IF Statement
IF Statement
The IF statement controls the execution of a block of commands or a
single command depending on whether the expression (or condition) is
true.
The IF statement consists of the reserved word IF, an expression
(condition), commands, the reserved word ELSE and other commands
which are optional, and the reserved word ENDIF.
When NetCI executes an IF statement, the following occurs:
1. NetCI evaluates the expression which is the condition.
2. If the condition is true and ELSE is specified, it executes the
subsequent commands that follow the condition and skips the
commands after ELSE to statements or commands after ENDIF. If
the condition is true and ELSE is not specified, it executes the
subsequent commands that follow the condition.
3. If the condition is false and ELSE is specified, it executes the
commands after ELSE. If the condition is false and ELSE is not
specified, flow control skips to statements or commands after ENDIF.
Syntax
IF expression
commands
[ELSE commands]
ENDIF
Parameters
expression Specifies the condition that determines whether the
commands following it will execute. The expression
must be in the following format:
identifier operator identifier
The identifier is a variable name, numerical value,
or known variable (set flag) in NetCI. The operator is
an equal sign (=), not equal sign (< >), greater than
sign (>), or less than (<) sign.
commands Specifies the commands to be executed provided the
expression (condition) is true.
commands Specifies the commands following ELSE to be executed
provided the expression (condition) is not true. The
ELSE statement and commands are optional.