On Fri, May 9, 2008 at 11:16 PM, Tim Conner <crofty_james / hotmail.com> wrote:
> What is the best way to delete every other value in a ruby array?
> e.g.
> %w(a b c d e f g h i j k)
>
> becomes => [a c e g i k]
>
> thanks
> --
>

Here is one way.

arr = %w[a b c d e f g h i j k]
p arr.select{|x| arr.index(x) % 2 == 0}

Harry

-- 
A Look into Japanese Ruby List in English
http://www.kakueki.com/ruby/list.html