Ada Programming/Attributes/'Image


Ada Lovelace 1838.jpg

DescriptionEdit

X'Image(Y) is an Ada attribute where X is any discrete type and Y is an instance of that type. This attribute returns a string representation of the value passed as input.

This attribute is a useful way to automatically convert from a type value to a string suitable for output.

ExampleEdit

type My_Enum is (Enum1, Enum2, Enum3);
...
pragma Assert (My_Enum'Image (Enum1) = "ENUM1");

See alsoEdit

WikibookEdit

Ada Reference ManualEdit

Last modified on 1 February 2013, at 01:42