Answers for "How can you get the position (index) of an item in an array? ruby"

4

ruby find index of element in array

a = [ "a", "b", "c" ]
a.index("b")              #=> 1
a.index("z")              #=> nil
Posted by: Guest on June-07-2020

Code answers related to "How can you get the position (index) of an item in an array? ruby"

Browse Popular Code Answers by Language