So I’m working on this lesson here…
and I thought it’d be cool to add more to it by trying to take someone’s input converting it into a boolean and based on whether it’s true or false provide the correct output (I hope that made sense ) anyway here’s my code:
print "Are you hungry?"
hunger = gets.chomp.downcase
if hunger == "yes"
** then hungry = true**
** else hungry = false**
**end if **
** unless hungry**
** puts “Go Ruby!”**
** puts “Time to eat!”**
Basically if a person were to type “Yes or yes”, it would make hungry = true and output “Time to eat!”
and if they type anything else hungry would be false and it’d output “Go Ruby!” Unfortunately, I can’t seem to figure out how to do that. I’m guessing it’s a process that I don’t know about yet but any feedback helps.
I realize I’m going past the lesson here but I really wanted to experiment and try out new things.