From: Matthew Harris Date: 2006-06-15T20:20:19+09:00 Subject: Re: Does each over an array bring a counter/index with it? You should be able to just use it. Maybe it may not be part of Enumerable in prior versions, which may require the use of "require 'enumerable'", but I'm unsure. On 6/15/06, Sidney Burks wrote: > Do you have to do > > 'require enumerable' > > each time you want to use it, or should it be accessible by default? > > > Thanks, > -Sidney > > On 6/15/06, Dave Burt wrote: > > > > Duane Morin wrote: > > > If I'm "each"ing over an array, is there a built-in way to get the > > > numeric index of the item that I'm on, or do I have to increment my own > > > counter variable? I saw each_with_index but that seems to be for Hash, > > > not Array. > > > > It's for Enumerable, which is mixed-in to Array and Hash, so you will be > > able to use it. > > > > Cheers, > > Dave > > > > > > -- Matt