In Fortran, any variable or expression is either *scalar*,
or has a non-zero *rank*. In the second case we are dealing with
an array--the rank is the number of dimensions to the array.

REAL A(5, 10), B(5, 10), C(5, 10)declares

A + B B * C A + (B * C)are legal expressions. Their results are arrays of the same shape as the operands.

`B * C`

stands for the table of values
Values held in corresponding positions in the arrays are multiplied together. As a special case, scalars are ``conformable'' with any array. If

REAL Dthen

`C + D`

represents
Array expressions (and variables) can also be formed by taking a
*sections* of a named array object. An array section is built from
some subset of the elements of an array object--those associated with
a selected subset of the index range attached to the object.
The simplest array section is formed by subscripting an array by
colon-separated range of index values. Suppose an array `X` is
declared by

INTEGER X(12)Then

`X(2:4)`

is a section containing the second, third
and fourth elements of `X(:)`

is a section containing the whole of `X(1:10:3)`

is an array section of size 4 containing
every third element of `1:10:3`

, and
the special cases `1:3`

and simply `:`

, are all referred
to as For multi-dimensional arrays, some dimensions could be subscripted with a normal scalar expression, and some could be ``sectioned'' with triplets. The rank of the resulting array variable is the number of dimensions that are triplet-subscripted.

Naturally one can use array-valued expressions
in assignments. The simplest version has exactly the same syntax as
the scalar Fortran assignment. The expression on the right hand side
of the assignment must be conformable with the array variable on
the left hand side.
A special form of array assignment allows one to restrict the
assignment to some subset of the array variable on the left-hand-side
by specifying a mask. A mask is `LOGICAL` array expression,
conformable with the variable. Assignment of the
corresponding element of the array expression on the right-hand is only
performed where the mask takes value `.TRUE.`

. Where the mask
is `.FALSE.`

, the variable is left unchanged. For example,
suppose `EVEN` is a logical array with indices from 1 to 10, whose
even-indexed elements are `.TRUE.`

and odd-indexed elements are
`.FALSE.`

. Then

WHERE (EVEN) X (1:10) = X (2:11) ENDWHEREreplaces the values in the section

`X(1:10)`

having even indices
with copies of the values of the next element in the array.
The set of Fortran intrinsic functions was extended to
include many array operations.
Some notable inclusions are the *array reduction*
functions including `SUM` and `PRODUCT` which
add or multiply together elements of an array; `MAXVAL` and
`MINVAL` which return largest or smallest elements of
an array; and `ANY` and `ALL`, which take the
disjunction and conjunction of the elements of a `LOGICAL`
array.
Other functions include the `SPREAD` function which ``adds an
extra dimension'' to an array, returning an array in which values from
the original array are replicated over the range of the new index;
`TRANSPOSE`, which returns an array containing in the elements of
its two dimensional argument, transposed; and shift operations which
return arrays with values shifted by a constant index offset in one of
the dimensions of the argument array.