FORALL statement

Standard: F77 F90 F95 F2003 F2008 F2018 Example program


<Syntax>

FORALL forall-spec forall-asgn-stmt

forall-spec ::= ( [ integer-type-spec :: ] triplet-spec-list [ , mask-expr ] )

triplet-spec-list ::= triplet [ , triplet ]...
triplet ::= name = expr : expr [ : expr ]

forall-asgn-stmt ::= variable = expr
| variable => expr

<Semantics>

The FORALL statement is equivalent to a FORALL construct containing only a single Forall Assignment statement, i.e.
      FORALL forall-spec forall-asgn-stmt
is exactly the same as
      FORALL forall-spec
            forall-asgn-stmt
      END FORALL

Like the FORALL construct, the FORALL statement is not recommended for normal use. Whenever possible, use normal DO loops (or a DO CONCURRENT construct), array assignment or a WHERE construct instead.

The FORALL statement is considered obsolescent in Fortran 2018.

<Related>

Array assignment, DO CONCURRENT construct, FORALL construct, INTEGER type, WHERE statement, WHERE construct