Created
May 13, 2015 05:04
-
-
Save atelic/5286e2c1e6297d57af05 to your computer and use it in GitHub Desktop.
Shortest FizzBuzz in ruby I can come up with
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
1.upto(100){|n|puts n%15==0?"FizzBuzz":n%5==0?"Buzz":n%3==0?"Fizz":n} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The world record is:
But I prefer:
Both are pretty fun abuses of the language. You can shave three bytes off your answer by using
n%i<1
instead ofn%i==0
.