Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
even / odd classifier using proc
f = proc do |p|
->{ p.odd? }.call => 'odd',
->{ p.even? }.call => 'even'
=> #<Proc:0x00007ff91188af38@(irb):1>
> f[1]
=> "odd"
> f[2]
=> "even"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.