Instantly share code, notes, and snippets.

Embed
What would you like to do?
multiple if examples in Ruby
# question 1, answer: 4
if 2 + 2 == x
alert "Correct!"
else
alert "Incorrect!"
end
# question 2, answer: 11
if 4 + 7 == x
alert "Correct!"
else
alert "Incorrect!"
end
# question 3, answer: 10
if 7 + 3 == x
alert "Correct!"
else
alert "Incorrect!"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment