Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
example if/guard clause in Ruby
# verbose
if 2 + 2 == 4
puts "Correct!"
# short-hand
puts "Correct" if 2 + 2 == 4
# more realistic short-hand
def addition_problem(user_answer, correct_answer)
puts "Correct" if user_answer == correct_answer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment