HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
ELSEWHERE
Chapter 10 337
ELSEWHERE
Introduces optional ELSEWHERE block within a WHERE construct.
Syntax
ELSEWHERE
Description
The ELSEWHERE statement introduces an ELSEWHERE block, which is an optional component of
the WHERE construct. The ELSEWHERE statement executes on the complement of the WHERE
condition. For additional information, see “WHERE (statement and construct)” on page 492.
Examples
WHERE( b .GE. 0.0 )
! Assign to sqrt_b only where logical array b is 0 or positive
sqrt_b = SQRT(b)
ELSEWHERE
sqrt_b = 0.0 ! Assign sqrt_b where b is negative
END WHERE
Related statements
WHERE and END (construct)
Related concepts
For information about the WHERE construct, see “Masked array assignment” on page 101.