arr = [1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4].reverseputs arr.values_at(* arr.each_index.select {|i| i.odd?})
Standard input is empty
3 1 3 1 3 1 3 1
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!