Skip to content

Instantly share code, notes, and snippets.

@jikkujose
Created December 10, 2013 10:12
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 jikkujose/7888436 to your computer and use it in GitHub Desktop.
Save jikkujose/7888436 to your computer and use it in GitHub Desktop.
FizzBuzz
def multiple_of number
Proc.new do |n|
(n % number) == 0
end
end
fb = (0..100).map do |n|
case n
when multiple_of(15)
"FizzBuzz"
when multiple_of(3)
"Fizz"
when multiple_of(5)
"Buzz"
else
n
end
end
puts fb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment