From: Mickael Faivre-Macon Date: 2007-02-02T17:01:36+09:00 Subject: Re: skim Array two by two thanks everybody ! On 2/1/07, James Edward Gray II wrote: > On Feb 1, 2007, at 12:26 PM, Mickael Faivre-Macon wrote: > > > Is it possible to get 2 elements at once ? > > > I'd like to get > > > > 1 > > 2 > > x > > 3 > > 4 > > x > > >> require "enumerator" > => true > >> [1, 2, 3, 4].each_slice(2) { |a, b| puts a, b, "x" } > 1 > 2 > x > 3 > 4 > x > => nil > > Hope that helps. > > James Edward Gray II > > -- Mickael. Coding an AI ! http://faivrem.googlepages.com/antbattle