From: Adam Prescott Date: 2013-02-15T18:35:33+09:00 Subject: Re: skip iteration in each loop --bcaec55245164ed08104d5bffdb6 Content-Type: text/plain; charset=UTF-8 A good rule of thumb when dealing with a "primitive" like an Array: if you're using a counter variable, you can probably get there faster: [1, 2, 3, 4, 5, 6].reject { |n| n >= 3 || n <= 5 } This returns a new Array. You can also use #select for selecting, and both methods have a version ending in ! to modify the object in place. Check out the documentation for Array and the Enumerable module which it includes. Familiarity with those methods will help jog your memory. --bcaec55245164ed08104d5bffdb6 Content-Type: text/html; charset=UTF-8

A good rule of thumb when dealing with a "primitive" like an Array: if you're using a counter variable, you can probably get there faster:

[1, 2, 3, 4, 5, 6].reject { |n| n >= 3 || n <= 5 }

This returns a new Array. You can also use #select for selecting, and both methods have a version ending in ! to modify the object in place.

Check out the documentation for Array and the Enumerable module which it includes. Familiarity with those methods will help jog your memory.

--bcaec55245164ed08104d5bffdb6--