find_index¶
Syntax¶
Parameters¶
value- An expression that evaluates to a single value, representing the value to find.
list-expression- An expression that evaluates to a list.
Returns¶
The index of the value in the list expression, or -1 if the value does not occur in the list.
Description¶
The find_index() action is used to find the index of a value in a list. Since lists are 0 indexed, the first item in the list is index 0, the second is index 1, and so forth.
If the value occurs more than once in the list, then the index of the first value is returned. If the value is not found in the list, then \(-1\) is returned.
Examples¶
Find the index of the value 2 from the list expression list(1,2,3). This returns 1.
This example returns -1 since the value 5 is not in the list.