I have been struggling with the conditional lesson in Ruby. The problem I get is that when I put in an Expression for my "unless" statement, I can only get my unless statement or my else statement to print. I can't get both statements to print depending on what my input for the question is.
Here is my code example. I may just be understanding this incorrectly.
print "Are you hungry at the moment?"
hungry = gets.chomp
puts "I'm writing Ruby programs! Leave me alone"
puts "Time to eat!"
This is what I would think would happen. When I answer my question "Are you hungry at the moment?" with a "No" I should get the "I'm writing Ruby Programs! Leave me alone". This is the result I get, which is good.
If I answer the question with a "Yes" answer I still get a result of "I'm writing Ruby programs! Leave me alone." Why would I not get the other message "Time to eat!". Because I put in "Yes" which I would think would be a true statement. I am hungry so I'm going to eat. Or is this kind of you get one or the other. Not, you can get either option depending how you answer the question.