From: GOTO Kentaro Date: 2002-05-06T05:57:13+09:00 Subject: Re: Iterators and index At Mon, 6 May 2002 05:38:50 +0900, David Corbin wrote: > But, what I'd like to be able to do, is this. > ---frag 2--- > list = ["Alpha", "Beta", "Gamma", "Delta" ] > > list.indexed_each() { |index,letter| doSomething(index+1,letter) } > ---end--- > > Is there a some slick way to do this? I know I could do There is each_with_index for you. list = %w(Alpha Beta Gamma Delta) list.each_with_index{|letter, index| doSomething(index+1, letter)} -- Gotoken