Created
October 29, 2011 08:32
-
-
Save vderyagin/1324236 to your computer and use it in GitHub Desktop.
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.upto(100) do |number| | |
str = '' | |
str << 'Fizz' if (number % 3).zero? | |
str << 'Buzz' if (number % 5).zero? | |
str << number.to_s if str.empty? | |
puts str | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment