WHERE statement

Standard: F77 F90 F95 F2003 F2008 F2018 Example program


<Syntax>

WHERE ( expression ) assignment-stmt

The expression must be an array of type Logical. The left-hand-side of the assignment statement must be an array variable with the same shape as expression.

<Semantics>

The WHERE statement is a masked assignment. The logical (mask) expression is evaluated, and only elements of the variable that correspond to true values of the mask are assigned to. Elemental operations in the right-hand-side of the assignment are likewise only performed where they correspond to true values of the mask.

<Related>

Array Constructor, Array Section, Array Assignment, DIMENSION attribute, ELSEWHERE statement, END WHERE statement, FORALL construct, FORALL statement, WHERE construct