Created
February 28, 2021 05:08
-
-
Save baweaver/65248793c0f73a891c5e7ff64a01d2ac to your computer and use it in GitHub Desktop.
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
divisible_by = -> n, v { v % n == 0 }.curry | |
(1..100).each { |v| | |
puts case v | |
when divisible_by[15] then 'FizzBuzz' | |
when divisible_by[3] then 'Fizz' | |
when divisible_by[5] then 'Buzz' | |
else | |
v | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment