Created
November 15, 2013 05:30
-
-
Save opheliasdaisies/7479578 to your computer and use it in GitHub Desktop.
Expansion of the one-line 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).map do |i| | |
fb_a = [["Fizz"][i % 3], ["Buzz"][i % 5]] | |
fb = fb_a.compact.join | |
if fb.empty? | |
puts i | |
else | |
puts fb | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can mark this file as a ruby file and it will get syntax highlighting =)