作为逆转
with Ada.Text_IO;
procedure Image_And_Value is
type Fruit is (Banana, Orange, Pear);
X : Fruit := Orange;
begin
Ada.Text_IO.Put_Line (Boolean'Image
(Fruit'Value (Fruit'Image (X)) = X
and
Fruit'Image (Fruit'Value ("ORANGE")) = "ORANGE"));
end Image_And_Value;
结果
TRUE