The Ada Program: fun.adb

  1 -- fun.adb:  arrays and functions
  2 
  3 with Ada.Text_IO, Ada.Integer_Text_IO;
  4 use Ada;
  5 
  6 procedure Fun is
  7 
  8    type Array_Type is array (1..10) of Boolean;
  9 
 10    A: Array_Type := (others => True);
 11 
 12    -- no definition in this declarative region of a variable, type,
 13    -- function (regardless of type), subprocedure, etc. named "A".
 14 
 15 begin
 16 
 17    declare
 18 
 19       -- This hides all variables (and arrays) named "A".
 20 
 21       function A (X: Integer) return Integer is
 22       begin
 23          return 0;
 24       end A;
 25 
 26    begin
 27       Integer_Text_IO.Put (A(2));
 28       Text_IO.New_Line;
 29    end;
 30 
 31 end Fun;