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-- error_handling_00.adb
18
19
20with Text_IO; use Text_IO;
21
22procedure Error_Handling_00 is
23
24 package Int_IO is new Integer_IO(Integer); use Int_IO;
25
26 N : Integer := 4;
27
28 D : Integer := 256;
29
30 Value : Integer;
31
32begin
33
34 for I in 1..N
35 loop
36
37 loop
38
39 begin
40 New_line;
41
42 Put("--> Value : ");
43 Get(Value);
44
45 D := D/Value;
46 Put(D);
47
48 New_line;
49
50 exit;
51 exception
52 when CONSTRAINT_ERROR => New_Line;
53 Put_Line("Try Again...");
54 end;
55
56 end loop;
57
58 end loop;
59
60end Error_Handling_00;