1.3- why doesn't this statement work?


print "Choose happy or sad."
vh = gets.chomp
if vh = happy
print "Congrats with the choice!"
print "It's a three letter word."
This code should respond based on the word choice. What is actually happening is after I put in the input I get an error message. The message states "undefined local variable or method" What am I missing and why is this happening?


For a comparison we use, ==.


mtf, I tried vh == happy and it's the same error message


Strings must be written in quotes, either single of double.


Thanks. I always forget that detail.


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