Instead of attribute Image
and Ada.Text_IO.Put
on enumeration literals we can only use the generic package Ada.Text_IO.Enumeration_IO
to print out the literals.
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
type Fruit is (Banana, Pear, Orange, Melon);
package Fruit_IO is new Enumeration_IO (Fruit); use Fruit_IO;
begin
for I in Fruit loop
Put (I);
New_Line;
end loop;
end;
BANANA
PEAR
ORANGE
MELON