A subscript triplet consists of three parts: the first two parts
designate a range of subscript values and the third part designates
the increment (stride) between each value. It takes the following
form:
[subscript-1] : [subscript-2] [:stride]
subscript-1 Is a scalar numeric expression representing
the first value in the subscript sequence.
If omitted, the declared lower bound of the
dimension is used.
subscript-2 Is a scalar numeric expression representing
the last value in the subscript sequence.
If omitted, the declared upper bound of the
dimension is used.
When indicating sections of an assumed-size
array, this subscript must be specified.
stride Is a scalar numeric expression representing
the increment between successive subscripts
in the sequence. It must have a nonzero value.
If it is omitted, it is assumed to be 1.
The stride has the following effects:
o If the stride is positive, the subscript range starts with the
first subscript and is incremented by the value of the stride,
until the largest value less than or equal to the second
subscript is attained.
For example, if an array has been declared as B(6,3,2), the
array section specified as B(2:4,1:2,2) is a rank-two array
with shape (3,2) and size 6. It consists of the following six
elements:
B(2,1,2) B(2,2,2)
B(3,1,2) B(3,2,2)
B(4,1,2) B(4,2,2)
If the first subscript is greater than the second subscript,
the range is empty.
o If the stride is negative, the subscript range starts with the
value of the first subscript and is decremented by the absolute
value of the stride, until the smallest value greater than or
equal to the second subscript is attained.
For example, if an array has been declared as A(15), the array
section specified as A(10:3:-2) is a rank-one array with shape
(4) and size 4. It consists of the following four elements:
A(10)
A(8)
A(6)
A(4)
If the second subscript is greater than the first subscript,
the range is empty.
If a range specified by the stride is empty, the array section has
a size of zero.
A subscript in a subscript triplet need not be within the declared
bounds for that dimension if all values used to select the array
elements are within the declared bounds. For example, if an array
has been declared as A(15), the array section specified as
A(4:16:10) is valid. The section is a rank-one array with shape
(2) and size 2. It consists of elements A(4) and A(14).
If the subscript triplet does not specify bounds or stride, but
only a colon (:), the entire declared range for the dimension is
used.