Created
December 10, 2013 10:12
-
-
Save jikkujose/7888436 to your computer and use it in GitHub Desktop.
FizzBuzz
This file contains hidden or 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
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