Last active
August 29, 2015 14:04
-
-
Save topher6345/4544804ec7794304409e to your computer and use it in GitHub Desktop.
Everyone loves FizzBuzz
This file contains hidden or 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
# functional but linter hates it | |
(1..100).map {|e| (e % 15).zero? ? "FizzBuzz": (e % 3).zero? ? "Fizz" : (e % 5).zero? ? "Buzz": e }.each {|e| puts e } |
This file contains hidden or 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
# linted | |
(1..100).map do |elem| | |
puts 'FizzBuzz' if (elem % 15).zero? | |
puts 'Fizz' if (elem % 3).zero? | |
puts 'Buzz' if (elem % 5).zero? | |
puts elem | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment