Ada Programming/Attributes/'Image
< Ada Programming < AttributesComputing » Computer Science » Computer Programming » Ada Programming

Description
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.
Example
type My_Enum is (Enum1, Enum2, Enum3); ... pragma Assert (My_Enum'Image (Enum1) = "ENUM1");
See also
Wikibook
Ada Reference Manual
- 13.3 Operational and Representation Attributes (Annotated)
- Annex K Language-Defined Attributes (Annotated)
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.