home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog2 / nesting.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  1.2 KB  |  48 lines

  1.                                        -- Chapter 8 - Program 5
  2.  
  3. with Text_IO;
  4. use Text_IO;
  5.  
  6. procedure Nesting is
  7.  
  8.    procedure Triple is
  9.  
  10.          procedure Second_Layer is
  11.  
  12.                procedure Bottom_Layer is
  13.                begin
  14.                   Put_Line("This is the Bottom Layer talking.");
  15.                end Bottom_Layer;
  16.  
  17.          begin
  18.             Put_Line("This is the Second Layer talking.");
  19.             Bottom_Layer;
  20.             Put_Line("We are back up to the Second Layer.");
  21.          end Second_Layer;
  22.  
  23.    begin
  24.       Put_Line("This is procedure Triple talking to you.");
  25.       Second_Layer;
  26.       Put_Line("We are back up to the procedure named Triple.");
  27.    end Triple;
  28.  
  29. begin
  30.    Put_Line("Start the triple nesting here.");
  31.    Triple;
  32.    Put_Line("Finished, and back to the top level.");
  33. end Nesting;
  34.  
  35.  
  36.  
  37.  
  38. -- Result of execution
  39.  
  40. -- Start the triple nesting here.
  41. -- This is procedure Triple talking to you.
  42. -- This is the Second Layer talking.
  43. -- This is the Bottom Layer talking.
  44. -- We are back up to the Second Layer.
  45. -- We are back up to the procedure named Triple.
  46. -- Finished, and back to the top level.
  47.  
  48.