with Ada.Text_io; use Ada.Text_io;
with Ada.Integer_Text_io; use Ada.Integer_Text_io;
procedure enum4 is
type Day is (Sunday, Monday, Tuesday,
Wednesday, Thursday, Friday, Saturday);
package Day_IO is new Enumeration_IO(Day);
use Day_IO;
d: Day;
i: Integer;
begin
for i in Day'Range loop
put(Day'Pos(i)); new_line;
end loop;
new_line;
for i in 0 .. Day'Pos(Day'Last) loop
put(i);
put(": ");
put(Day'Val(i));
new_line;
end loop;
put(Day'Image(Monday)); new_line;
d := Monday;
if d = Day'Value("Monday") then
put_line("Time to get moving!");
elsif d = Day'Value(" fRiDAY ") then
put_line("Time to get relax!");
end if;
if d < Friday then
put(Day'Pos(Friday) - Day'Pos(d), 0);
put(" days until Friday!");
end if;
new_line;
i := Integer'Value("3");
put(i);
end enum4;