Created
January 24, 2016 16:49
-
-
Save tohyongcheng/6f4e3686e163015c7c19 to your computer and use it in GitHub Desktop.
Ruby: FizzBuzz
This file contains hidden or 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
# If a number is divisible by 3, return "Fizz". | |
# If a number is divisible by 5, return "Buzz". | |
# If a number is divisible by 3 and 5, return "FizzBuzz" | |
def fizzbuzz(x) | |
___ | |
end | |
assert_equal fizzbuzz(3), "Fizz" | |
assert_equal fizzbuzz(50), "Buzz" | |
assert_equal fizzbuzz(15), "FizzBuzz" | |
assert_equal fizzbuzz(5175), "FizzBuzz" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment