Skip to content

Instantly share code, notes, and snippets.

@CliveIMPISA
Created September 27, 2014 13:10
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 CliveIMPISA/1ddb608cea56c0fa75a8 to your computer and use it in GitHub Desktop.
Save CliveIMPISA/1ddb608cea56c0fa75a8 to your computer and use it in GitHub Desktop.
Shortest Ruby FizzBuzz Implementation
# Shortest FizzBuzz
def fizzbuzz(size)
1.upto size do |num|
yield num % 15 == 0 ? 'FizzBuzz' : num % 5 == 0 ? 'Buzz' : num % 3 == 0 ? 'Fizz' : num.to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment