Next: Intrinsic Functions
Up: Professional Programmer's Guide to
Previous: STOP Statement
Any set of computations can be encapsulated in a procedure. The
main purpose of a procedure is to allow the same set of operations
to be invoked at different points in a program. Procedures also
make it possible to use the same code in several different
programs. It is good practice to split a large program into sections
whenever it becomes too large to be handled conveniently in one
piece. The optimum size of a program unit is quite small, probably
no more than 100 lines.
Four different forms of procedure can be used in Fortran
programs:-
- Intrinsic functions
- Statement functions
- External functions (also known as function subprograms)
- Subroutines.
Intrinsic functions are provided automatically by the Fortran system,
whereas the other three forms of procedure are user-written. Statement
functions, which are defined with the statement function statement, can
be only be used in the program unit in which they were defined and are
subject to other special restrictions. External functions and
subroutines are two alternative forms of external procedure: each is
specified as a separate program unit and can be used (with only a few
restrictions) anywhere else in the program.
Mario Storti
Wed Nov 4 19:32:56 ART 1998