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:
NetCI evaluates the expression which
is the condition.
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.
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.
Discussion |
 |
You may nest both IF and
WHILE statements in script files.
A maximum of 20 IF statements and
20 WHILE statements (for a total
of 40 statements) may be nested together within the same script
file.