Category : Pascal Source Code
Archive   : PASTUT.ZIP
Filename : FORWARD.PAS

 
Output of file : FORWARD.PAS contained in archive : PASTUT.ZIP
(* 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 *)




{ Result of execution

The value of the count is now 6
The value of the count is now 5
The value of the count is now 4
The value of the count is now 3
The value of the count is now 2
The value of the count is now 1

The value of the count is now 7
The value of the count is now 6
The value of the count is now 5
The value of the count is now 4
The value of the count is now 3
The value of the count is now 2
The value of the count is now 1

}


  3 Responses to “Category : Pascal Source Code
Archive   : PASTUT.ZIP
Filename : FORWARD.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/