411 REFERENCE · Wikibooks
Ada Programming/Attributes/'Length
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Attributes 'Length
__TOC__
Description
'Length is an array type attribute. It may be used with or without an input parameter.
Without an input parameter, 'Length is an integer that represents the length of the first dimension of the array type.
With an input parameter, 'Length(N) is an integer that represents the length of the Nth dimension of the array type. N must be a positive number within the dimensions of the array.
Example
If you declare:
type My_Vector is array (1 .. 7) of Integer;
type My_Matrix is array (1 .. 5, 1 .. 10) of Integer;
then
Assert (My_Vector'Length = 7);
Assert (My_Matrix'Length(1) = 5);
Assert (My_Matrix'Length(2) = 10);
Assert (My_Vector'Length(1) = My_Vector'Length);
Assert (My_Matrix'Length(1) = My_Matrix'Length);
See also
Wikibook
Ada Programming
Ada Reference Manual
13 3 Operational and Representation Attributes
K Language-Defined Attributes
Length
Length