From: "Simon Kröger" Date: 2005-11-25T21:01:34+09:00 Subject: Re: Faster way to pick the every other array member? Damphyr wrote: > we have [1,2,3,4,5,6,7] and want [2,4,6] > > Is there a way other than > > fields=[1,2,3,4,5,6,7] > fields.collect!{|f| > f if fields.index(f)%2==1 > }.compact! > > And by another way I mean something shorter and more beautiful :). > Cheers, > V.- what about: f = true fields = fields.select{f=!f} cheers Simon