Ada Programming/Attributes/'First
Description
editX'First
, where X
is any scalar subtype (for example integer, enumerated, real), is an attribute that represents the first value (lower bound) in the range of X
.
A'First
, where A
is an array, denotes the first index value. For more-dimensional arrays, A'First(N)
denotes the first index value of the Nth dimension (N must be static).
Example
edittype
My_Enumis
(Enum1, Enum2, Enum3);type
My_Intis
range
-1 .. 5; ...pragma
Assert (My_Enum'First = Enum1); -- OKpragma
Assert (My_Int'First = -1); -- OKpragma
Assert (My_Int'First = 0); -- Wrong!