Hi --
I'd always thought that yield was just syntactic sugar for calling the
block, but I notice there's at least one difference:
def x(&b)
b.call
puts "Still here (x)"
end
def y
yield
puts "Still here (y)"
end
lam = lambda { return }
x &lam
y &lam
Output:
Still here (x)
retu.rb:11: unexpected return (LocalJumpError)
from retu.rb:11:in `y'
from retu.rb:14
I'm trying to sort out all the return/Proc/lambda combinations... and
this one struck me as odd.
David
--
David A. Black
dblack / wobblini.net