From: Tim Bates Date: 2002-11-26T11:51:43+09:00 Subject: each_with_index & collect_with_index? Array.each (and others) have an alternative .each_index which passes the index to the element instead of the element itself to the block. Is there an easy way to pass both the index and the element, eg something like Array.each_with_index{ |i, el| ... } Also, an equivalent for these in 'collect' could be useful, eg Array.collect_index{ |i| ... } Array.collect_with_index{ |i, el| ... } How about it? Tim Bates -- tim@bates.id.au