Skip to content

Instantly share code, notes, and snippets.

@tohyongcheng
Created January 24, 2016 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tohyongcheng/6f4e3686e163015c7c19 to your computer and use it in GitHub Desktop.
Save tohyongcheng/6f4e3686e163015c7c19 to your computer and use it in GitHub Desktop.
Ruby: FizzBuzz
# 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