Yurttas/PL/IL/Ada-95/F/02/03/01/error handling 12.adb
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-- date : January 1, 1998.
12-- author : Salih Yurttas.
13
14-- purpose : Error handling by exceptions.
15
16-- error_handling_12.adb
17
18
19with Ada.Text_IO;
20use Ada.Text_IO;
21
22with Error_Handling_02_P;
23use Error_Handling_02_P;
24
25procedure Error_Handling_12 is
26
27 Decision : Boolean := True;
28
29begin
30
31 while Decision
32 loop
33 begin
34 case Decision is
35 when False => PA;
36 Put_Line("One,");
37 when True => PB;
38 Put_Line("Two,");
39 Decision := not Decision;
40 end case;
41 exception
42 when others => Put_Line(" done.");
43 end;
44 end loop;
45
46 Put_Line(" First.");
47
48 while not Decision
49 loop
50 begin
51 case Decision is
52 when True => PB;
53 Put_Line("Three,");
54 when False => PA;
55 Put_Line("Four,");
56 Decision := not Decision;
57 end case;
58 exception
59 when others => Put_Line(" done.");
60 end;
61 end loop;
62
63 Put_Line(" Last.");
64
65end Error_Handling_12;