Please help me


<Below this line, add a link to the EXACT exercise that you are stuck
can anyone explain to me what is wrong with this code?

puts "what is your favorite genre of movies?"

if user_input=["Horror","Action"]
puts "Nice taste"
elsif user_input=["Romance","Chick Flick"]
puts "thats horrible"
puts "ehh there alright i guess"

Replace this line with your code.


user_input will be a string, not an array. Recall, also, that we need to compare, ==.

To continue,

puts " ... "              # display a prompt
user_input = gets.chomp   # get string and remove trailing white space

if user_input == "Horror" || user_input == "Action"    # || => or
    # code
# ...

And furthermore,

Ruby does have an include? method for looking inside an array...

if ["Horror", "Action"].include? (user_input)
    # code

but this might be jumping ahead of the lesson.

Lastly, please post a link to the exercise. Thanks.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.