Intermediate
Ruby
Q41 / 100
What is the difference between a Proc and a Lambda in Ruby?
Correct! Well done.
Incorrect.
The correct answer is B) Lambdas enforce strict argument count and "return" only exits the lambda, while Procs are more lenient with arguments and "return" exits the enclosing method
B
Correct Answer
Lambdas enforce strict argument count and "return" only exits the lambda, while Procs are more lenient with arguments and "return" exits the enclosing method
Explanation
Lambdas check the number of arguments strictly and a "return" inside returns from the lambda itself, whereas Procs are lenient about arity and "return" returns from the enclosing method context.
Progress
41/100