I'm trying to write a method that takes the user's input and checks it for validity. It's in a "case...when" statement. This part checks that the user has entered a Y or N only.
when 3
input = gets.chomp.to_s.downcase
unless input (=="y") || (=="n")
puts "That is not a valid choice. Please enter Y or N."
get_input(text, 3)
end
The compiler doesn't like my boolean statement and I'm not sure why. It tells me "syntax error, unexpected [x]" and points to various parts of the statement. Pretty much tearing my hair out here... am I doing something obvious wrong?
unless ['y', 'n'].include?(input).unless (input=='y' or input=='n')