From: Hugh Sasse Staff Elec Eng Date: 2001-01-18T00:13:23+09:00 Subject: [ruby-talk:9439] array.each_index_but_last ? What is the idiomatic Ruby way to go through all the elements of an array, except the last one, gettting the index? my_array.each_index { |i| unless i == my_array.last { # ... } } seems less than neat. Reason I want to do this -- If one is producing a difference table from an array such that: d[i] = a[i+1] - a[i] one doesn't want to fall off the end... Hugh