From: Luc Heinrich Date: 2006-03-13T08:32:04+09:00 Subject: Re: array element access On 12 mars 06, at 21:34, Tomas Fischer wrote: > I've got an array a= [1,2,3,4,5,6] and want to access each second > element: > b=[2,4,6]. How is this done in ruby? irb(main):001:0> a = [1,2,3,4,5,6] => [1, 2, 3, 4, 5, 6] irb(main):002:0> a.select {|e| a.index(e) % 2 == 1 } => [2, 4, 6] -- Luc Heinrich - luc@honk-honk.com - http://www.honk-honk.com