-- Code of Figure 6.1, page 198 from
-- Kenneth C. Louden, Programming Languages
-- Principles and Practice 2nd Edition
-- Copyright (C) Brooks-Cole/ITP, 2003

with Text_IO; use Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;

procedure Enum is
  type Color_Type is (Red,Green,Blue);
  -- define Color_IO so that Color_Type values can be printed
  package Color_IO is new Enumeration_IO(Color_Type);
  use Color_IO;
  x : Color_Type := Green;
begin
  x := Color_Type'Succ(x); -- x is now Blue
  x := Color_Type'Pred(x); -- x is now Green
  put(x); -- prints GREEN
  new_line;
end Enum;
