Intel® Fortran Compiler 16.0 User and Reference Guide

Functions, Subroutines, and Statement Functions

Functions, subroutines, and statement functions are user-written subprograms that perform computing procedures. The computing procedure can be either a series of arithmetic operations or a series of Fortran statements. A single subprogram can perform a computing procedure in several places in a program, to avoid duplicating a series of operations or statements in each place.

The following table shows the statements that define these subprograms, and how control is transferred to the subprogram:

Subprogram

Defining Statements

Control Transfer Method

Function

FUNCTION or ENTRY

Function reference1

Subroutine

SUBROUTINE or ENTRY

CALL statement2

Statement function

Statement function definition

Function reference

1 A function can also be invoked by a defined operation (see Defining Generic Operators).

2 A subroutine can also be invoked by a defined assignment (see Defining Generic Assignment).

A function reference is used in an expression to invoke a function; it consists of the function name and its actual arguments. The function reference returns a value to the calling expression that is used to evaluate the expression.

See Also