From: Eric Christopherson Date: 2012-02-04T02:32:24+09:00 Subject: Re: Basic Ruby performance On Fri, Feb 3, 2012 at 11:17 AM, Dmitry Nikiforov wrote: > Here's a question: when I say "for a in ( 0..1E8 )" - does Ruby create > an array and populate is with values from 0 through 1E8, or does it > merely create a counter similar to "for( a = 0; a<=1e8, a++ )" ? It might make a counter-based loop internally, but at a higher level it translates it into an iterator using Enumerable#each. The iterator knows how to return the next number in the range each time. It doesn't create an array with 1E8+1 elements.