Mega Code Archive

 
Categories / Ruby / Range
 

Find all odd elements

(1..8).find_all {|x| x%2==1}  # => [1,3,5,7]: find all odd elements