Skip to content

Instantly share code, notes, and snippets.

@acrookston
Created September 23, 2014 01:07
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 acrookston/a3e8e263c9e6eb083968 to your computer and use it in GitHub Desktop.
Save acrookston/a3e8e263c9e6eb083968 to your computer and use it in GitHub Desktop.
Cross-posting my FizzBuzz challenge from Forrst: http://zurb.com/forrst/posts/FizzBuzz-R33
(1..100).each{|i| puts (i%3==0?'Fizz': '')+(i%5==0?'Buzz': '')+(i%3==0||i%5==0?'': i.to_s)}
@Veedrac
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