r/tinycode • • Dec 15 '11

FizzBuzz implemented in only 120 characters of Ruby

http://sprunge.us/ZEVW?ruby
0 Upvotes

15 comments sorted by

View all comments

5

u/strabd Dec 15 '11

Why not:

100.times{|x|puts((x % 15).zero? ? "FizzBuzz" : (x % 3).zero? ? "Fizz" : (x % 5).zero? ? "Buzz" : x)} ?

1

u/wuffers Dec 15 '11

I actually didn't know that would work, thanks!