< Ada Programming < Attributes 
 
 
      
Ada. Time-tested, safe and secure.
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:
typeMy_Vectorisarray(1 .. 7)ofInteger;typeMy_Matrixisarray(1 .. 5, 1 .. 10)ofInteger;
then
pragmaAssert (My_Vector'Length = 7);pragmaAssert (My_Matrix'Length(1) = 5);pragmaAssert (My_Matrix'Length(2) = 10);pragmaAssert (My_Vector'Length(1) = My_Vector'Length);pragmaAssert (My_Matrix'Length(1) = My_Matrix'Length);
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.