From: Brian Candler Date: 2010-04-11T16:30:50+09:00 Subject: Re: Hash name increment on iteration? Shaz wrote: > Each with index worked for me - didn't realize each variable in the > array has an index that can be called. Not exactly. The 'each_with_index' method just yields the array index to the block being called. Inside it will be implemented something like this: module Enumerable def each_with_index i = 0 each do |elem| yield elem, i i += 1 end end end But you could consider it like this: class Array def each_with_index size.times do |i| yield self[i], i end end end -- Posted via http://www.ruby-forum.com/.