partition range : partition « Range « Ruby






partition range


(1..8).partition {|x| x%2==0}  # => [[2, 4, 6, 8], [1, 3, 5, 7]]

 

Related examples in the same category