Created
September 27, 2014 13:10
-
-
Save CliveIMPISA/1ddb608cea56c0fa75a8 to your computer and use it in GitHub Desktop.
Shortest Ruby FizzBuzz Implementation
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
# 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