Skip to content

Instantly share code, notes, and snippets.

@jonatas
Created July 9, 2012 02:36
Show Gist options
  • Save jonatas/3073888 to your computer and use it in GitHub Desktop.
Save jonatas/3073888 to your computer and use it in GitHub Desktop.
fizz buzz
(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
@jonatas
Copy link
Author

jonatas commented Jul 9, 2012

vi isso aq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment