3 ms·
How did .each have weird scoping pre-1.9? I've run across problems with for-loops, but .each has always behaved predictably, even in 1.8. Could you perhaps pro
by weavejester 14y ago
How did .each have weird scoping pre-1.9? I've run across problems with for-loops, but .each has always behaved predictably, even in 1.8.
Could you perhaps provide an example of code using .each that does the wrong thing in 1.8, but the right thing in 1.9?
- judofyr 14y agoa = 0 [1, 2, 3].each { |a| } a # => 3
- weavejester 14y agoAh, thanks for the clarification. I guess that means there are at least two odd things about scoping in 1.8 loops.