Syntax
Returns the position of the current element, counted from 0.
ListIndex(<list>())Parts
| <list> | A list declared with NewList, written with its empty parentheses: scores(). |
|---|
Returns
A position from 0 to ListSize() - 1, or -1 when there is no current element or the list was freed.
Good to know
- There is no current element in a new list, after ResetList(), ClearList(), SortList() or RandomizeList(), and after a walk that ran past either end.
Example
NewList a.integer()Console(Str(ListIndex(a()))) ' -1FOR k = 1 TO 3 AddElement(a())NEXTSelectElement(a(), 1)Console(Str(ListIndex(a()))) ' 1In the manual : Arrays, lists and maps