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 n instead of starting at the beginning; i.e. n=0.
You can also do
array.drop(n).each { |v| puts v }
0...n-1 entries still be there?You can call a subarray with a range like this:
array[n..-1].each { |value| puts value } Where n is the index you'd like to start at, and -1 will always point to the last index of an array.
next if value < n, which avoids the need to create the temporary array array[n..-1]. You could also write puts array[n..-1].