Created
July 9, 2012 02:36
-
-
Save jonatas/3073888 to your computer and use it in GitHub Desktop.
fizz buzz
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).to_a.each do |i| | |
multiple_three = i % 3 == 0 | |
multiple_five = i % 5 == 0 | |
puts "#{i} #{[ ('Fizz' if multiple_three), | |
('Buzz' if multiple_five) | |
].compact.join("-")}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
vi isso aq