Array.High

Top  Previous  Next

Returns the highest index value for the given array.

 

Syntax

function Array.High(AArray: array): integer

 

Alternative Names

ibec_High

 

Description

Returns the highest index value for the given array, returns -1 if there's no possible index value.

 

AArray holds an existing array.

 

The Return Value is the highest index value that can be used to retrieve a value in the array. If the array has a length of 15, the return value is 14. If the array has a length of 4, the return value is 3.

 

Example

execute UDSBlock returns (index_value integer, single_array_value varchar(100))

as

begin

  array_value = Array.Create('zero');

  index_value = Array.High(array_value);

  single_array_value = array_value[index_value];

  suspend; /* returns 0 and 'zero' */

  

  array_value[4] = 'four';

  index_value = Array.High(array_value);

  single_array_value = array_value[index_value];

  suspend; /* returns 4 and 'four' */

 

  Array.SetLength(array_value, 10);

  array_value[8] = 'eight';

  index_value = Array.High(array_value);

  array_value[index_value] = 'nine';

  suspend; /* returns 9 (and 'four') */

end