From: Brian Candler Date: 2008-09-22T19:52:47+09:00 Subject: Re: for or each? Sylvain Joyeux wrote: > Nope. each { } needs one new scope for each iteration while "for ... in" > explicitely uses the parent scope... In the end, you create with #each > as many objects as there are in your collection P.S. Here's a simple experiment, and I can't see any of these dark-matter objects that you talk about. def countobj count = 0 ObjectSpace.each_object(Object) { count += 1 } count end def foo :dummy end puts "#{countobj} objects" GC.disable (1..1_000_000).each { foo } puts "#{countobj} objects" -- Posted via http://www.ruby-forum.com/.