public
Created

  • Download Gist
proc_vs_lambda.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11
>> p = Proc.new { |a, b| a }
=> #<Proc:0x00000001036962f8@(irb):2>
>> p.call(5)
=> 5
>> l = lambda { |a, b| a }
=> #<Proc:0x000000010368e8c8@(irb):4>
>> l.call(5)
ArgumentError: wrong number of arguments (1 for 2)
from (irb):4
from (irb):5:in `call'
from (irb):5

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.