On May 9, 9:16 am, Tim Conner <crofty_ja... / 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
> --
> Posted viahttp://www.ruby-forum.com/.

This will work, but I'm not sure if it's the best way.

a = %w(a b c d e f g h i j k)
1.upto(a.size) {|i| a.delete_at i}