Skip to content

Instantly share code, notes, and snippets.

@kch
Created February 2, 2010 08:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kch/292489 to your computer and use it in GitHub Desktop.
Who doesn't love fizzbuzz?
i, f = 1, 100
i.upto(f) { |n| puts \
[[3, "Fizz"], [5, "Buzz"]].map { |d, s|
s if n % d == 0 }.join.sub(/^$/, n.to_s) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment