Language:
Русский
English
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.
Example
(* Forwarded procedure *)
procedure Flip(N: Integer); forward;
procedure Flop(N: Integer);
begin
WriteLn('Flop');
if N > 0 then Flip(N - 1);
end;
procedure Flip;
begin
WriteLn('Flip');
if N > 0 then Flop(N - 1);
end;