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

  1.                                        -- Chapter 9 - Program 2
  2. procedure Scope2 is
  3.  
  4.    Count, Index : INTEGER;
  5.  
  6.    procedure Level1 is
  7.       Index, Count : INTEGER;
  8.  
  9.       procedure Level2 is
  10.          Count : INTEGER;
  11.       begin
  12.          Count :=                             -- Count from line 10
  13.                   Scope2.Count;               -- Count from line 4
  14.       end Level2;
  15.  
  16.       procedure Level2_Prime is
  17.          Data, Index, Count : INTEGER;
  18.          Outer_Index : INTEGER renames Scope2.Level1.Index;
  19.       begin
  20.  
  21.          Count := Index                        -- Count from line 17
  22.                         + Scope2.Level1.Count; -- Count from line 7
  23.  
  24.          Index :=                              -- Index from line 17
  25.                   Scope2.Level1.Index +        -- Index from line 7
  26.                    Scope2.Index;               -- Index from line 4
  27.  
  28.          Index :=                              -- Index from line 17
  29.                   Outer_Index +                -- Index from line 7
  30.                    Scope2.Index;               -- Index from line 4
  31.  
  32.       end Level2_Prime;
  33.  
  34.    begin
  35.       null;
  36.    end Level1;
  37.  
  38.    procedure Other_Level1 is
  39.    begin
  40.       Count := Index;                         -- Both from line 4
  41.    end Other_Level1;
  42.  
  43. begin
  44.    Count := Index;                            -- Both from line 4
  45. end Scope2;
  46.  
  47.  
  48.  
  49.  
  50. -- Result of execution
  51.  
  52. -- (No output from this program)
  53.  
  54.