ELSEWHERE statement

Standard: F77 F90 F95 F2003 F2008 F2018 Example program


<Syntax>

ELSEWHERE [ construct-name ]

ELSEWHERE ( expression ) [ construct-name ]

The expression shall be of type Logical and shall have the same shape as the expression in the WHERE construct statement. The construct-name shall appear if and only if the WHERE construct is named.

Since Fortran 95, ELSEWHERE may be spelled as two words “ELSE WHERE” (Fortran 90 did not have masked ELSEWHERE).

<Semantics>

The ELSEWHERE and masked ELSEWHERE statements are part of the WHERE construct, which controls a set of masked array assignments.

The statements in an ELSEWHERE part are executed only for those elements for which the WHERE mask expression was false and all ELSEWHERE mask expressions of this construct are also false.

The statements in a masked ELSEWHERE part are executed only for those elements for which the WHERE mask expression was false, all previous ELSEWHERE mask expressions of this construct are false, and this ELSEWHERE mask expression is true. Note that only elements of this ELSEWHERE mask expression that correspond to false elements of all previous masks are evaluated.

<Related>

END WHERE statement, WHERE construct, WHERE statement