with Ada.Text_IO;
use Ada.Text_IO;
procedure Except4 is
procedure Try_It is
Value :constant :=8;
subtype LIMIT_RANGE is Integer range 14..33;
Funny :LIMIT_RANGE:=Value;
begin
Put_Line("We are in the try_it procedure ");
exception
when Constraint_Error=>Put_Line(" Constraint error occured!");Put_Line(" Detected in procedure Try_It");
end Try_It;
procedure Try_To_Fix_It is
begin
Put_Line("We are in the Try_to_Fix it");
Try_It;
exception
when Constraint_Error=>Put_Line("Constraint error occured!");Put_Line("Detected in procedure Try_To_Fix_It");
end Try_To_Fix_It;
begin
Put_Line("Begin program here.");for Count in 1..4 loop
Put_Line("ready to call try_to_fix_it.");
Try_To_Fix_It;
New_Line;
end loop;Put_Line("end of program");
exception
when Constraint_Error=>
Put ("Range error detected at the");Put_Line(" main program level.");Put_Line("Program terminated.");
end Except4;