I thought when you called a proc within a method the return value of the proc would trigger a return from the out block context that called the proc. When I call test(a_block)
I feel like the puts "after the block"
should not be executed as there was a return value from the proc. Further... test(a_block)
and test(b_block)
behave exactly the same. I thought there was supposed to be a difference here?
a_block = Proc.new do
puts "in the Proc"
55
end
b_block = lambda do
puts "in the lambda"
66
end
def test(block)
puts "in test"
puts block.call
puts "after the block"
99
end
puts test(a_block)
puts test(b_block)