Yurttas/PL/IL/Ada-95/Exceptions/ehand 00.adb

From ZCubes Wiki
Jump to navigation Jump to search
 1--
 2-- Copyright (C) 1998
 3-- All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4--
 5-- Permission to use, copy, modify, and distribute this 
 6-- software and its documentation for EDUCATIONAL purposes
 7-- and without fee is hereby granted provided that this 
 8-- copyright notice appears in all copies. 
 9-- 
10-- 
11 
12-- date   : January 1, 1998.
13-- author : Salih Yurttas.
14
15-- purpose : Error handling by exceptions.
16
17-- ehand_00.adb
18
19
20with Text_IO; use Text_IO;
21 
22procedure EHand_00 is
23
24  package Int_IO is new Integer_IO(Integer); use Int_IO;
25 
26  k   : Integer := 256;
27  I_V : Integer;
28 
29begin
30 
31  for i in 1..4
32  loop
33
34    loop
35
36      begin
37        New_line;
38        Put ("--> I_V : ");
39        Get (I_V);
40        k := k/I_V;
41        Put(k);
42        New_line;
43        exit;
44      exception
45        when CONSTRAINT_ERROR => New_Line;
46                                 Put_Line("Try Again..");
47      end;
48
49    end loop;
50
51  end loop;
52 
53end EHand_00;