From: "T. Onoma" Date: 2003-12-03T23:50:40+09:00 Subject: Re: each_with_what_index? On Wednesday 03 December 2003 12:23 pm, Gavin Sinclair wrote: > > Bugs can be like that sometimes, but there's absolutely nothing > unintutive about that, unless you want Ruby to start guessing what you > really mean all the time :) Saying that there's "absolutely nothing unintutive about that" is a real stretch. Obviously, I have asked for certain indexes [1..-1], but we know that #[ ] is really just a form of slice, so what we get is a new array, thus reindexed form [0..a.length-2]. It's understandable, but I sure wouldn't call it intuitive. > Maybe this is better for you? > > a.each_with_index do |t,i| > next if i == 0 > puts "#{t} => #{a[i]}" > # ... > end I did: a[1..-1].each_with_index do |t,i| puts "#{t} => #{a[i+1]}" # ... end Thinking it would be more efficient. Hmm...Or does this have a bug? T.