Yurttas/PL/IL/Ada-95/F/02/01/00/block 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 block for compound statements
15-- with local/global scope.
16
17-- block_00.adb
18
19
20with Ada.Text_IO;
21use Ada.Text_IO;
22
23procedure Block_00 is
24
25 package Int_IO is new Integer_IO(Integer);
26 use Int_IO;
27
28 Choice_Item : Integer;
29
30begin
31
32 Put("--> Choice_Item : ");
33 Get(Choice_Item);
34 Skip_Line;
35
36 case Choice_Item is
37 when 1 | 2 => declare
38 H : String := "One-Two";
39 A : Integer := 8;
40 begin
41 Put_Line(H);
42 Put(A);
43 end;
44 when 3 | 4 => declare
45 package Flo_IO is new Float_IO(Float);
46 use Flo_IO;
47
48 H : String := "Three-Four";
49 A : Float := 1.25;
50 begin
51 Put_Line(H);
52 Put(A);
53 end;
54 when others => null;
55 end case;
56
57 New_Line;
58
59end Block_00;