Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Cross-posting my FizzBuzz challenge from Forrst:
(1..100).each{|i| puts (i%3==0?'Fizz': '')+(i%5==0?'Buzz': '')+(i%3==0||i%5==0?'': i.to_s)}

This comment has been minimized.

Copy link

Veedrac commented Sep 23, 2014

Basic compression:

(1..100).each{|i|puts (i%3==0?'Fizz':'')+(i%5==0?'Buzz':'')+(i%3*i%5==0?'':i.to_s)}

I don't actually know Ruby but it seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.