data = [[1,2], [0,1], [7,8]] data.find_index {|x| x.include? 1} # => 0: the first element matches data.find_index {|x| x.include? 3} # => nil: no such element