411 REFERENCE · Wikibooks
Ada Programming/Attributes/'Last
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Attributes 'Last
__TOC__
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
type My_Enum is (Enum1, Enum2, Enum3);
type My_Int is range -1 .. 5;
...
Assert (My_Enum'Last = Enum3); OK
Assert (My_Int'Last = 5); OK
Assert (My_Int'Last = 4); Wrong!
See also
Wikibook
Ada Programming
Ada Programming/Attributes
Ada Programming/Attributes/'First
Ada Programming/Attributes/'Range
Ada Reference Manual
13 3 Operational and Representation Attributes
K Language-Defined Attributes
Last