ListLastIndexOf Function

Action

Returns the index of the last occurrence of an element.

Include file

List.bdh

Syntax

ListLastIndexOf(
   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 last occurrence of element

Example

transaction TAListLastIndexOf
var
  lstNumber: list of number init 1, 2, 333, 4, 5, 333;
  retVal: number;
begin
  retVal := ListLastIndexOf(lstNumber, 333);
  writeLn("index of 333: " + string(retVal));
  
  ListRemoveAt(lstNumber, 6);
  retVal := ListLastIndexOf(lstNumber, 333);
  writeLn("index of 333: " + string(retVal));
end TAListLastIndexOf;

Output

index of 333: 6
index of 333: 3