Array Section

Standard: F77 F90 F95 F2003 F2008 F2018 Example program


<Syntax>

data-object ( section [ , section ]... )

section ::= subscript | vector | triplet

subscript ::= scalar-integer-expr

vector ::= integer-expr
A vector must be an array expression of rank 1.

triplet ::= [ scalar-integer-expr ] : [ scalar-integer-expr ] [ : scalar-integer-expr ]

An array section contains at least one section that is not a subscript.

<Semantics>

An array section is a portion of an array variable or constant.

A vector-subscripted array section is not allowed to be modified by passing it as an actual argument; also, a vector-subscripted array section can only be assigned to if there are no repeated values in the vector(s).

Each triplet specifies a range of subscript values similarly to a DO loop, viz. lower, upper, and stride (in that order). A missing expression for any of these values is taken to be the lower bound of that dimension, the upper bound of that dimension, or one, respectively. The stride must be non-zero. If a triplet specifies no elements (e.g. “5:2”), the extent of that dimension in the array section is zero.

An array section that does not contain a vector subscript is a rectangular portion of the parent array, and its rank is equal to the number of triplets.

Note that except for zero-sized extents, all subscript values must be within the array bounds for the dimension.

The lower bounds of an array section are all equal to one, regardless of the lower bounds of the parent array.

<Related>

Array Assignment, Array Constructor, DIMENSION statement, FORALL construct, FORALL statement, WHERE construct, WHERE statement