Skip to content

Instantly share code, notes, and snippets.

@jwietelmann
Created February 18, 2012 20:04
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 jwietelmann/1860879 to your computer and use it in GitHub Desktop.
Save jwietelmann/1860879 to your computer and use it in GitHub Desktop.
Lazy FizzBuzz
(1..100).each do |n|
str = ""
str += "Fizz" if (n % 3).zero?
str += "Buzz" if (n % 5).zero?
puts str.empty? ? n.to_s : str
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment