forward (procedure directive)


 forward (procedure directive)

With a forward declaration, you can make a procedure or function known without actually specifying its statement part.

From the point of the forward declaration, other procedures and functions can call the forwarded routine, making mutual recursion possible.

Somewhere after a forward declaration, the procedure or function must be defined by a declaration that specifies the statement part of the routine.

The defining declaration can omit the parameter list from the procedure or function header.


 (* Forwarded procedure *)
 procedure Flip(N: Integer); forward;

 procedure Flop(N: Integer);
   if N > 0 then Flip(N - 1);

 procedure Flip;
   if N > 0 then Flop(N - 1);

Тэги: forward
| G+
Код для вставки: :: :: :: ::
Поделиться: // //