Vector.last_index_of
last_index_ofconditionstart
Group: Values
Documentation
Returns the last index of an element in the vector. Returns Nothing
if the element is not found.
Arguments
condition
: Either the element to search for, aFilter_Condition
or a predicate function to test each element.start
: The index to start searching backwards from. If the index is negative, it is counted from the end of the vector.
Examples
Find the last index of an element in a vector.
[1, 2, 3, 1, 2, 3].last_index_of 2 == 4
Find the index of the last palindrome.
["ab", "abab", "aba", "bbb"].last_index_of (s-> s == s.reverse) == 3