A literal inside a enumeration is a discrete type so we can use attribute Image
to find out which literal it is as text form. Notice that this prints out the same word as in the code (but in upper case).
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
type Fruit is (Banana, Pear, Orange, Melon);
begin
for I in Fruit loop
Put (Fruit'Image (I));
New_Line;
end loop;
end;
BANANA
PEAR
ORANGE
MELON