Skip to content

Instantly share code, notes, and snippets.

@ismaelga
Created March 8, 2013 02:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ismaelga/5113834 to your computer and use it in GitHub Desktop.
Save ismaelga/5113834 to your computer and use it in GitHub Desktop.
def multiple number
proc {|n| (n % number) == 0 rescue nil }
end
(0..100).each do |number|
puts case number
when multiple(15) then "FizzBuzz"
when multiple(5) then "Buzz"
when multiple(3) then "Fizz"
else number
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment