home *** CD-ROM | disk | FTP | other *** search
- -- Chapter 18 - Program 3
- with Text_IO;
- use Text_IO;
-
- procedure Recurson is
-
- package Int_IO is new Text_IO.Integer_IO(INTEGER);
- use Int_IO;
-
- Index : INTEGER;
-
- procedure Print_And_Decrement(Value : in INTEGER) is
- New_Value : INTEGER;
- begin
- Put("The value of the index is now");
- Put(Value);
- New_Line;
- New_Value := Value - 1;
- if New_Value > 0 then
- Print_And_Decrement(New_Value);
- end if;
- end Print_And_Decrement;
-
- begin
- Index := 7;
- Print_And_Decrement(Index);
- end Recurson;
-
-
-
-
- -- Result of execution
-
- -- The value of the index is now 7
- -- The value of the index is now 6
- -- The value of the index is now 5
- -- The value of the index is now 4
- -- The value of the index is now 3
- -- The value of the index is now 2
- -- The value of the index is now 1
-
-