Do you receive the Programmer's Heaven newsletter? If not, why not subscribe?

View \FORWARD.PAS

Getting Started with the Pascal tutorial, source

Submitted By: WEBMASTER
Rating: (Not rated) (Rate It)


(* Chapter 5 - Program 8 *)
program Forward_Reference_Example;

var Number_Of_Times : integer;

procedure Write_A_Line(var Count : integer); forward;

procedure Decrement(var Index : integer);
begin
   Index := Index - 1;
   if Index > 0 then
      Write_A_Line(Index);
end;

procedure Write_A_Line;
begin
   Writeln('The value of the count is now ',Count:4);
   Decrement(Count);
end;

begin  (* main program *)
   Number_Of_Times := 7;
   Decrement(Number_Of_Times);
   Writeln;
   Number_Of_Times := 7;
   Write_A_Line(Number_Of_Times);
end(* of main program *)

corner
© 1996-2008. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin.
bootstrapLabs Logo A bootstrapLabs project.