[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
Recursion and forward

Recursion and forward

The statement

forward IDENTIFIER;

is used to defer the definition of a function or procedure value for IDENTIFIER. After the forward declaration, another function or procedure may be called which uses IDENTIFIER, although IDENTIFIER has not yet been defined.

This statement is required in cases where two functions or procedures call one another in mutual recursion.

It may also be used at the top of a file of functions or procedures, so that the principal routines can be defined before the smaller routines which they call.

The forward-statement must occur on the main level, that is, outside other functions and procedures.

[Next] [Prev] [Right] [Left] [Up] [Index] [Root]