The Ada Program: simple_for.adb
1 -- simple_for.adb: program illustrating simple "for" loops
2
3 with Ada.Text_IO, Ada.Integer_Text_IO;
4 use Ada;
5
6 procedure Simple_For is
7
8 subtype Index_Range is Integer range 1..10;
9 type Day_Type is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
10 package Day_Type_IO is new Text_IO.Enumeration_IO (Enum=>Day_Type);
11
12 begin
13
14 for I in 1..10 loop
15 Integer_Text_IO.Put (I);
16 end loop;
17
18 for I in Index_Range loop
19 Integer_Text_IO.Put (I);
20 end loop;
21
22 for I in Index_Range'Range loop
23 Integer_Text_IO.Put (I);
24 end loop;
25
26 Text_IO.New_Line;
27
28 for D in Mon..Sun loop
29 Day_Type_IO.Put (D, Set=>Text_IO.Lower_Case);
30 end loop;
31
32 for D in Day_Type loop
33 Day_Type_IO.Put (D, Set=>Text_IO.Lower_Case);
34 end loop;
35
36 for D in Day_Type'First .. Day_Type'Last loop
37 Day_Type_IO.Put (D, Set=>Text_IO.Lower_Case);
38 end loop;
39
40 for D in Day_Type'Range loop
41 Day_Type_IO.Put (D, Set=>Text_IO.Lower_Case);
42 end loop;
43
44 end Simple_For;