Iterate over a array and returning the next and the element before current

Viewed 11016

How may i fetch next and before current element from array while iterating array with each.

array.each do |a|
   # I want to fetch next and before current element.
end
2 Answers
Related