HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
IF (arithmetic)
Chapter 10368
IF (arithmetic)
Transfers control to one of three labels.
Syntax
IF (
arithmetic-expression
)
labelN
,
labelZ
,
labelP
arithmetic-expression
is an arithmetic expression of any numeric type except complex and double
complex.
label
is a label of an executable statement.
Description
The arithmetic IF statement transfers control to the statement whose label is determined by
arithmetic-expression
. If
arithmetic-expression
evaluates to a negative value, control
transfers to
labelN
; if it evaluates to 0, control transfers to
labelZ
; and if it evaluates to a
positive value, control transfers to
labelP
.
The same label may appear more than once in the same arithmetic IF statement.
Each label must be that of an executable statement in the same scoping unit as the arithmetic
IF.
Examples
i = -1
! Branch to statement labeled 10
IF (i) 10, 20, 30
Related statements
IF (construct) and IF (logical)
Related concepts
For information about flow control statements, see “Flow control statements” on page 146.