On 1/20/06, James Edward Gray II <james / grayproductions.net> wrote: > On Jan 20, 2006, at 8:08 AM, Pat Maddox wrote: > > > Is there a way to get each element of an array, as well the index of > > that element? > > You bet. > > > Something like > > a = %w[foo bar] > > a.each { |val, index| .... } # val => 'foo', index => 0 > > a.each_with_index ... > > James Edward Gray II > > Perfect, thanks Is this using some idiom (e.g. attaching _with_index) that I don't know about? I didn't see that method in the Array rdoc.