NET/MASTER Network Control Language (NCL) Reference Manual

IF
Core Statements
2–30 106126 Tandem Computers Incorporated
IF The IF core statement evaluates an expression and selects an execution path based on
the outcome. The THEN keyword, which must be used with the IF statement,
precedes the NCL statements that you want to execute if the expression is true. You
can construct nested IF statements by pairing each ELSE clause with the innermost IF
statement, as shown in the second example for this core statement.
NCL treats the IF through ELSE statements as a block. It is an error to transfer control
to any label between these two statements from outside the block.
IF
expression
THEN
true-statement(s)
[ ELSE
false-statement(s)
]
expression
specifies an expression that is true (1) or false (0); any other value is an error.
THEN
specifies a required keyword that delimits the expression.
true-statement(s)
specifies the statement you want to execute if the expression is true (1). Multiple
statements must be contained within a DO group. You cannot specify a null
statement; it causes a compilation error. If you want nothing to happen, use the
NOP statement.
ELSE
specifies an optional keyword introducing an alternative logic path when the
expression is false (0). This keyword, when present, must start on a new line.
false-statement(s)
specifies the statement you want to execute if the expression is false (0). Multiple
statements must be contained within a DO group. You cannot specify a null
statement; it causes a compilation error. If you want nothing to happen, use the
NOP statement.
Considerations
Single IF statements containing multiple Boolean expressions are more efficient
than multiple IF statements.
Labeling statements in a DO group within an IF statement is allowed, but the DO
group itself must not be labeled. See the DO core statement in this section, where
labels within DO groups are discussed.