There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
Agree with a comment or answer? Like () to up-vote the contribution!
print “How many Children do you have?”
user_num = Children(gets.chomp)
if user_num < 0
puts “Sorry, you are not eligble for children’s free pass!”
elsif user_num > 0
puts “congrtulations, you are eligble for children’s free pass!”
else user_num = 0
puts “sorry, you are not elible for children’s free pass!”
end
Okay, thanks for your reply. Much appreciated! (It’s not that big a deal— mostly just me being “Curious George.”)
I was trying to write an if/else statement such that it asked for the user to enter a score (presumably from a hypothetical test).
If the score was > 70, it would print, “Well done! You passed the test.”
If the score was < 70, it would print, “You have not passed. Better luck next time!”
But I must have missed something somewhere because it wouldn’t run.
Careful not to complicate things. Go for the bare minimum, as described above. ‘if…else’. You are only looking for one condition, a pass. The rest fall to the default, else.