Lahey/Fujitsu Fortran

Types of Procedures

Fortran has two varieties of procedures: functions and subroutines. Procedures are further categorized in the following table:

Procedures

Functions

Intrinsic Functions

Generic Intrinsic

Functions

Specific Intrinsic

Functions

External Functions

Generic External

Functions

Specific External

Functions

Internal Functions

Statement Functions

Subroutines

Intrinsic

Subroutines

Generic Intrinsic

Subroutines

Specific Intrinsic

Subroutines

External Subroutines

Generic External

Subroutines

Specific External

Subroutines

Internal Subroutines

Intrinsic procedures are built-in procedures provided by the Fortran processor. Fortran has over one hundred standard intrinsic procedures. Each is documented in detail in the Alphabetical Reference.

An external procedure is defined in a separate program unit and can be separately compiled. It is not necessarily coded in Fortran. External procedures and intrinsic procedures can be referenced anywhere in the program.

An internal procedure is contained within another program unit. It can only be referenced from within the containing program unit.

Internal and external procedures can be referenced recursively if the RECURSIVE keyword is included in the procedure definition.

Intrinsic and external procedures can be either specific or generic. A generic procedure has specific versions, which can be referenced by the generic name. The specific version used is determined by the type, kind, and rank of the arguments.

Additionally, procedures can be elemental or non-elemental. An elemental procedure can take as an argument either a scalar or an array. If the procedure takes an array as an argument, it operates on each element in the array as if it were a scalar.