qp.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
FORWARD Keyword
  Keywords Contents Index                                   Back
 
  FUNCTION <identifier>( <formal parameter list> ) : <type>; FORWARD;
 
  PROCEDURE <identifier>( <formal parameter list> ); FORWARD;
 
  Description
 
    FORWARD, when placed after a function or procedure declaration,
    allows the use of that function or procedure before it is defined.
    It is useful in cases of mutual recursion, in which it is not
    possible to define a procedure or function before it is called. For
    example,
 
       CONST
           cloying = 10;
       VAR
           sweetness : Integer;
 
       PROCEDURE John; FORWARD;
 
       PROCEDURE Marsha;
           BEGIN
           Inc( sweetness );
           IF sweetness <> cloying THEN
               BEGIN
               Writeln( 'John' );
               John;
               END;
           END;
 
       PROCEDURE John;
           BEGIN
           Writeln( 'Marsha' );
           Marsha;
           END;
 
       BEGIN
       sweetness := 0;
       Marsha
       END.