flang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 222: Find first index of an element in list
Idiom # 222: Find first index of an element in list
See
programming-idioms.org
:
Code
i := ((container.searchable_sequence items).index_of x).get -1
What are effects?
Running Example
ex222 is x := 5 items := [1,2,3,4,5,6,7] i := ((container.searchable_sequence items).index_of x).get -1 say "found $x at index $i" x := 55 i := ((container.searchable_sequence items).index_of x).get -1 say "found $x at index $i"
What are effects?
next: Idiom # 223: for else loop