I am trying to search an Array for a value, if that value is found then return that the value is found and the index at which it was found. If the value is not found then the index returned is -1
array = [1, 2, 3] search_value = gets.chomp array.map.include?(search_value) || -1 if index != -1 puts "Found " + search_value + " at " + index.to_s The expected result is Found 2 at 1 instead I receive Found 2 at True, I understand why this is happening but I don't know how to fix it