Created
February 18, 2012 20:04
-
-
Save jwietelmann/1860879 to your computer and use it in GitHub Desktop.
Lazy FizzBuzz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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