FORTRAN Reference Manual

Statements
FORTRAN Reference Manual528615-001
7-27
DO Statement
For additional information about array size and storage, see Section 2, Language
Elements.
Examples
The following statements declare and dimension a 10-element array, in which each
array element contains 15 characters:
CHARACTER item*15
DIMENSION item(0:9)
The following statement declares a two-dimensional array:
DIMENSION numbers(5, 11)
DO Statement
The DO statement specifies a DO loop that repeats execution of one or more
statements.
label
is the label of an executable statement called the terminal statement of the DO
loop.
var
is an integer, real, or double precision control variable. It must be a simple variable,
not an array element or a RECORD component.
iexp
is an expression that specifies the initial value of var.
fexp
is an expression that specifies the maximum value of var within the loop.
incr
is an expression that specifies the increment value of var. The default value for
incr is 1.
Considerations
A DO loop includes all the executable statements following the DO statement up to
and including the terminal statement.
Execution of the DO loop proceeds as follows:
DO label [,] var = iexp, fexp [, incr ]