print “how old are you?”
user_age = Integer(gets.chomp)
if user_age < 40
puts “Not too shabby!”
What confuses me is this. How does Ruby know that gets.chomp is linked to print"how old are you?" It seems that the relation shouldn’t be automatic. After all, we’re not using “div” for instance or using something like "user_age = print “how old are you?”.
I don’t know if I’m explaining this right. It just seems there is a jump in logic. How does Ruby know that ‘gets.chomp’ applies to whatever number is contained in user_age?