Forwarding Forwarding - 1 year ago 67
Ruby Question

How to loop through an array using .each starting at an index in Ruby

Ok, so we all know that you can do the following:

array.each{ |value|
puts value

What if, however, I want to start at element
instead of starting at the beginning; i.e.

Answer Source

You can also do

array.drop(n).each { |v| puts v }

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download