Returns the index of the first occurrence of an element.
List.bdh
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. |
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;
index of 111: 1 index of 111: 3