Skip to content

Instantly share code, notes, and snippets.

@luckydev
Created August 14, 2011 05:41
Show Gist options
  • Save luckydev/1144621 to your computer and use it in GitHub Desktop.
Save luckydev/1144621 to your computer and use it in GitHub Desktop.
Proc and Lambda: Difference 2 - Arguments Check
my_super_code = lambda { |a,b| return a+b; }
puts my_super_code.call(1,2,5)
#=> ArgumentError: wrong number of arguments (3 for 2)
my_super_code = Proc.new { |a,b| return a+b; }
puts my_super_code.call(1,2,5)
#=> 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment