使用 Image 屬性列印列舉
Version = 有 2012 年(TC-1)
with Ada.Text_IO;
procedure Main is
type Fruit is (Banana, Orange, Pear);
X : Fruit := Orange;
begin
Ada.Text_IO.Put_Line (X'Image);
Ada.Text_IO.Put_Line (Pear'Image);
end Main;
結果
ORANGE
PEAR