Each_with_index. Can you start at a desired index position?


#1

When using array.each_with_index how do you start at a desired index
position?

I can do it like this, but its not very clean and doesnt seem efficient
:

desired_index_start = 20
array.each_with_index do |value,index|
next if index<desired_index_start
end

Thanks
Chris


#2

Here’s one way.

array[20…-1].each_with_index do |value,index|

end

Brian B.