The Ada Program: more_abstraction.adb

  1 -- more_abstraction.adb:  Ada program illustrating functions
  2 
  3 with Ada.Text_IO, Ada.Integer_Text_IO;
  4 use Ada;
  5 
  6 procedure More_Abstraction is
  7 
  8     procedure Put_Line (I: in Integer) is
  9     begin
 10         Integer_Text_IO.Put (Item => I);
 11         Text_IO.New_Line;
 12     end Put_Line;
 13 
 14     function Pow_1 (N: Integer) return Integer is
 15     begin
 16        return (2**N - 1);
 17     end Pow_1;
 18 
 19 begin
 20 
 21     Text_IO.Put_Line ("Hi!");
 22 
 23     Put_Line (I => Pow_1(3));
 24 
 25     Put_Line (I => Pow_1(4));
 26 
 27     Text_IO.Put_Line ("Hi, again.");
 28 
 29     Put_Line (I => Pow_1(5));
 30 
 31     Put_Line (I => Pow_1(6));
 32 
 33     Text_IO.Put_Line ("The end.");
 34 
 35 end More_Abstraction;