ListIndexOf Function

Action

Returns the index of the first occurrence of an element.

Include file

List.bdh

Syntax

ListIndexOf(
   in theList: list,
   in element: union): number;
Parameter Description
theList List of number, boolean, float or string.
element Number, boolean, float or string. Has to conform with the type of theList.

Return value

  • the index of the first occurrence of element

Example

transaction TAListIndexOf
var
  lstNumber: list of number init 111, 2, 3, 111, 2, 3;
  retVal: number;
begin
  retVal := ListIndexOf(lstNumber, 111);
  writeLn("index of 111: " + string(retVal));
  
  ListRemoveAt(lstNumber, 1);
  retVal := ListIndexOf(lstNumber, 111);
  writeLn("index of 111: " + string(retVal));
end TAListIndexOf;

Output

index of 111: 1
index of 111: 3