< Ada Programming < Attributes 
 
 
      
Ada. Time-tested, safe and secure.
Description
X'Last, where X is any scalar subtype (for example integer, enumerated, real), is an attribute that represents the last value (upper bound) in the range of X.
A'Last, where A is an array, denotes the last index value. For more-dimensional arrays, A'Last(N) denotes the last index value of the Nth dimension (N must be static).
Example
typeMy_Enumis(Enum1, Enum2, Enum3);typeMy_Intisrange-1 .. 5; ...pragmaAssert (My_Enum'Last = Enum3); -- OKpragmaAssert (My_Int'Last = 5); -- OKpragmaAssert (My_Int'Last = 4); -- Wrong!
See also
Wikibook
Ada Reference Manual
    This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.