From: Harry Kakueki Date: 2008-05-11T08:39:54+09:00 Subject: Re: Delete every other value in an array > > 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 > > Oops. My code has a bug. It can fall down when there are duplicates. Try this. arr = %w[a b c d b f g h i j k l m] p arr.select{|x| arr.index(x) % 2 == 0}#> ["a", "c", "g", "i", "k", "m"] res = [] (0...arr.length).step(2) {|x| res << arr[x]} p res #> ["a", "c", "b", "g", "i", "k", "m"] Harry -- A Look into Japanese Ruby List in English http://www.kakueki.com/ruby/list.html