Challenge 3: Proc vs Lambda Arity — Solution add_proc = Proc.new { |a, b| a.to_i + b.to_i } add_lambda = lambda { |a, b| a + b } puts add_proc.call(5) # Proc: missing arg silently becomes nil begin add_lambda.call(5) # Lambda: raises ArgumentError instead rescue ArgumentError => e puts "Lambda raised: #{e.message}" end =begin Output: 5 Lambda raised: wrong number of arguments (given 1, expected 2) Notes: - add_proc.call(5) does NOT raise an error. The Proc is lenient about argument count: b simply becomes nil since no second argument was given. .to_i is used here so nil.to_i (which is 0) doesn't crash the addition — without it, a + b would raise a NoMethodError trying to add nil. - add_lambda.call(5) DOES raise an ArgumentError immediately, the same way calling an ordinary method with the wrong number of arguments would. Lambdas enforce strict arity; Procs do not. - This is exactly the "strict vs lenient" distinction from the chapter, and it's a real reason to prefer lambdas when a caller passing the wrong number of arguments should fail loudly instead of silently producing a wrong result. =end