RosettaCodeData/Task/Higher-order-functions/Ruby/higher-order-functions-2.rb

10 lines
82 B
Ruby
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
def succ(n)
n+1
end
def to2(m)
m[2]
end
meth = method(:succ)
to2(meth) #=> 3