Skip to content

Instantly share code, notes, and snippets.

@baweaver
Created February 28, 2021 05:08
Show Gist options
  • Save baweaver/65248793c0f73a891c5e7ff64a01d2ac to your computer and use it in GitHub Desktop.
Save baweaver/65248793c0f73a891c5e7ff64a01d2ac to your computer and use it in GitHub Desktop.
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