Last active
November 3, 2017 16:07
-
-
Save mtowers/a54e16db647abcc02df73505812d9915 to your computer and use it in GitHub Desktop.
FizzBuzz in Ruby
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 |i| | |
out = { fizz: 3, buzz: 5 }.map do |k, v| | |
k if 0 == i % v | |
end.compact.join('') | |
puts "#{i}: #{out}" unless out.empty? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment