From: Ken Bloom Date: 2008-09-21T12:32:01+09:00 Subject: Re: for or each? Phlip wrote: > Joe Wölfel wrote: > >> It's interesting that array access using 'each' seems to be much >> faster on my machine. > > Does 'for' reevaluate its range after each tick? That would give > 'for' a single technical advantage over .each, in the very rare > chance you need that. No: class Numeric def foo puts "foo" self end end for i in 1..10.foo puts i end prints: foo 1 2 3 4 5 6 7 8 9 10 => 1..10 -- Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/