FORTRAN Reference Manual

Statements
FORTRAN Reference Manual528615-001
7-5
Statement Function
For additional information about numeric type declarations, see Section 2, Language
Elements.
Examples
The following statement declares EXPENSE as a double precision variable:
DOUBLE PRECISION expense
The following statement declares the variable CURRENT as a complex variable:
COMPLEX current
The following statement declares the variables POPULATION and CONSUMPTION as
doubleword integers.
INTEGER*4 population, consumption
Statement Function
A statement function is a nonexecutable single-statement computation.
function-name
is an identifier that specifies the function name.
dmy
is a variable that is a statement function dummy argument.
expression
is an arithmetic or character expression.
Considerations
A statement function has the scope of its containing program unit. It must appear
following all declaration statements and before the first executable statement of
that program unit.
The relationship between function-name and expression must conform to the
rules for assignment statements. See the Assignment Statement on page 7-7.
The actual arguments passed to a statement function must agree in number, order,
and type with the dummy arguments of the statement function.
FORTRAN executes a function statement as follows:
1. It evaluates actual arguments that are expressions.
2. It associates actual arguments with their corresponding dummy arguments.
function-name ( [ dmy [, dmy ]... ] ) = expression