So I’m following along and doing the Psych Test [burrito, taco, wets_bed] program in Chris Pine… yes, I changed to the lyrics of “Escape: The Pina Colada song” but otherwise, kept the same.
However, it’s getting stuck on the first ‘ask’ . . . help?
I don’t want to change this drastically, just trying to find where the program is getting hung.
# Nice little questionnaire
def ask question
good_answer = false
while (not good_answer)
puts question
reply = gets.chomp.downcase
if (reply == 'yes' or reply == 'no' )
good_answer == true
if reply == 'yes'
answer = true
else
answer = false
end
else
puts 'Please answer "yes" or "no".'
end
end
answer # This is what we return (true or false)
end
puts 'Hello, and thank you for smoking.'
puts
ask 'Do you like pina-coladas?'
ask 'Do you like getting caught in the rain?'
risky_business = ask 'Do you know what your sig other likes?'
ask 'Are you into yoga?'
ask 'Do you have half a brain?'
puts 'Just a few more questions.'
ask 'Do like the feel of the ocean?'
ask 'Are you into champagne?'
puts
puts 'DEBRIEFING'
puts 'Thank\'s for all the fish'
puts
puts risky_business
That’s it.
I’m wondering if this could be a Ruby version issue?
Thanks!
is this line a problem?
good_answer == trueshouldn’t it be
good_answer = true