Hi,
In message "Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks"
on Wed, 10 Jan 2007 23:47:43 +0900, James Edward Gray II <james / grayproductions.net> writes:
|> |And otherwise 1.9 still uses the 1.8 lexical scoping semantics, yes?
|>
|> Yes, other local variables are local to innermost surrounding block.
|> At least until I make a big decision.
|
|I really like this approach. What's the downside to this choice?
I sometimes want to take out values from the block and I hate to be
forced to assign only for "variable declaration", for example
ary.each {|x|
if cond(x)
val = func(x)
break
end
}
p val # val is out-of-scope
matz.