Skip to content

Instantly share code, notes, and snippets.

@wlangstroth wlangstroth/fizz.rb

Created Mar 29, 2011
Embed
What would you like to do?
still ugly, but I like it better
#!/usr/bin/env ruby
(1..100).each do |n|
out = ""
if n.modulo(3) == 0
out += "Fizz"
end
if n.modulo(5) == 0
out += "Buzz"
end
if out == ""
out = n.to_s
end
puts out
end
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.