SplitScript reference / [T] / indexOf
[T].indexOf
Method
[T].indexOf(value: T) -> u32? where T: Equatable
Finds the first index containing an equal element.
Returns None when the value is absent. The index is a u32, matching the array indexing and length APIs, and the element type must support equality.
Parameters
value: The element to find.
Effects: pure
Runtime behavior: available everywhere; synchronous
Examples
Find a checkpoint in a route table
let route = [2, 4, 7]
let bossIndex = route.indexOf(7)