Created
August 14, 2011 05:41
-
-
Save luckydev/1144621 to your computer and use it in GitHub Desktop.
Proc and Lambda: Difference 2 - Arguments Check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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