Created
September 13, 2011 02:26
-
-
Save havenwood/1213011 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 |n| | |
r = "" | |
r << "fizz" if n % 3 == 0 | |
r << "buzz" if n % 5 == 0 | |
r << n.to_s if r.empty? | |
puts r | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment