HP Pascal/iX Reference Manual (31502-90022)

12- 34
END;
VAR
v_file1 : t_file;
v_file2 : s_file;
v_file3 : FILE OF t_rec;
v_file4 : FILE OF s_rec; {error}
BEGIN
END.
IF
IF is an HP Pascal Option.
The IF compiler option specifies code to be compiled conditionally,
depending on the value of a Boolean expression.
Syntax
$IF '
Boolean_expression
'$
Parameter
Boolean_expression
Any constant Boolean expression containing the
operators AND, OR, and NOT and parentheses. The SET
compiler option must assign the value TRUE or
FALSE to each identifier before it appears in
Boolean_expression
. The identifier operands cannot
have the spellings of Boolean operators (NOT, AND,
OR). The operators are evaluated in the order
dictated by HP Pascal operator precedence.
Default Not applicable.
Location Anywhere.
The IF option
must
be used with the SET and ENDIF options, and
can
be
used with the ELSE option, as follows:
$SET '
identifier
=
Boolean
[{,}
identifier
=
Boolean
]'$
[{;} ]
$IF
Boolean_expression$
[
source code
]
[
to be compiled
]
[
if Boolean_expression
]
[
is TRUE
]
$ELSE$
[
source code
]
[
to be compiled
]
[
if Boolean_expression
]
[
is FALSE
]
$ENDIF$
IF options can be nested; that is, the source code to be compiled
conditionally can contain IF options. The maximum nesting level is 16.
Because the IF, ENDIF, ELSE, and SET options (together) allow conditional
compilation, several programmers with different needs can use them to
customize a single compilation unit.
Example 1
The following two program fragments are equivalent: