Hi,

I want to write a function that calculate the time difference between
two following elements in an array. But then I need access to both
elements in this array.

When I use an iterator I only get the actual element of the array:

array.each {|element|
  # previous = element.previous()
  element.delay = element.time - previous.time
}

Can someone tell me, how I could implement this function in a clever
way?
(A for-loop would also work, but that is not as smart as it is used to
be in Ruby.)

Thanks,
Sven