ListGetLength Function

Action

Returns the length of a list.

Include file

List.bdh

Syntax

ListGetLength(
   in theList: list) : number;
Parameter Description
theList List of number, boolean, float or string.

Return value

  • the length of the list

Example

transaction TAListGetLength
var
  lstNumber:  list of number init 10, 20, 30;
  lstBoolean: list of boolean init true, false, true, false;
  lstFloat:   list of float init 1.1, 2.2, 3.3, 4.4, 5.5;
  lstString:  list of string init "one", "two", "three", "four", "five", "six";
begin
  writeln("ListGetLength(lstNumber)  == " + string(ListGetLength(lstNumber)));
  writeln("ListGetLength(lstBoolean) == " + string(ListGetLength(lstBoolean)));
  writeln("ListGetLength(lstFloat)   == " + string(ListGetLength(lstFloat)));
  writeln("ListGetLength(lstString)  == " + string(ListGetLength(lstString)));
end TAListGetLength;

Output

ListGetLength(lstNumber)  == 3
ListGetLength(lstBoolean) == 4
ListGetLength(lstFloat)   == 5
ListGetLength(lstString)  == 6