Finds an item in a list.
iPos = ListFind (lList, aItem)
Variable | Description |
---|---|
iPos | The position of the item. INTEGER. |
lList | The list to search. LIST. |
aItem | The item to find. ANYTYPE. |
ListFind returns the position of aItem in lList. ListFind returns zero if the item is not in the list.
[-] LIST lsFruit = {...} [ ] "apples" [ ] "oranges" [ ] "bananas" [ ] Print (ListFind (lsFruit, "oranges")) // prints: 2 [ ] Print (ListFind (lsFruit, "pears")) // prints: 0