From: Michael Kelly Date: 2002-01-07T05:16:25+09:00 Subject: [ruby-talk:30364] Re: move index back ward in list.each do {} On 5 Jan 2002 16:14:38 -0800, kinfe0@netscape.net (Kinfe) wrote: > At this point I would like to advance the next index in a.each but >remain in b.each, another word, b[4] will not become b[5] after the >a[had advance], how can I do ? To alter indexes inside a loop I think generally it's better to use a while or some other simple loop with counters instead of trying to alter the behavior of an iterator. A while loop like the one below with a few edits should do what you need i = 0 j = 0 while (i < a.length) and (j < b.length) if a[i] == b[j] # or some other condition i += 1 # only advance one index next end i += 1 j += 1 #do something on each loop end Mike -- "I don't want to belong to any club that would have me as a member." -- Groucho Marx