Created
January 1, 2018 21:55
-
-
Save ryanckulp/6daabf5abe6958a35e41afecf1e626e5 to your computer and use it in GitHub Desktop.
method with addition operation in Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def addition_problem(user_answer, correct_answer) | |
if user_answer == correct_answer | |
alert "Correct!" | |
else | |
alert "Incorrect!" | |
end | |
end | |
# question 1, answer: 4 | |
addition_problem(3, 4) # returns 'false' | |
# question 2, answer: 11 | |
addition_problem(12, 11) # returns 'false' | |
# question 3, answer: 10 | |
addition_problem(10, 10) # returns 'true' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment