Yurttas/PL/IL/Ada-95/F/03/01/02/00/case e 00.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 : to demonstrate using case selection statement
15-- with Enumerated choices.
16
17-- case_e_00.adb
18
19
20with Ada.Text_IO;
21use Ada.Text_IO;
22
23procedure Case_E_00 is
24
25 type First_Last is (First, Last);
26
27 package E_IO is new Enumeration_IO(First_Last);
28 use E_IO;
29
30 F_L : First_Last;
31
32begin
33
34 Put("--> First : "); New_Line;
35 Put(" or Last : ");
36
37 Get(F_L);
38 Skip_Line;
39
40 case F_L is
41 when First => Put("First - ");
42 Put(F_L);
43 New_Line;
44 when Last => Put("Last - ");
45 Put(F_L);
46 New_Line;
47 end case;
48
49end Case_E_00;