ada Attribute Image As Inverses


Example

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;

Result

TRUE