From: Dan Doel Date: 2003-08-21T01:52:51+09:00 Subject: Re: for/in loop Paul Brannan wrote: > It's definitely not pointless: > > for i in [1, 2, 3] > x = i > end > p x #=> 3 > > [1, 2, 3].each do > y = i > end > p y #=> test.rb:9: undefined local variable or method `y' for # (NameError) > To do the same using #each, you'd need: y = nil [1, 2, 3].each do|i| y = i end Which is uglier, I admit, but still possible. - Dan