Range Ruby

(1..8).select {|x| x%2==0}    # => [2,4,6,8]: select even elements