Mega Code Archive
Categories
/
Ruby
/
Range
Partition range
(1..8).partition {|x| x%2==0} # => [[2, 4, 6, 8], [1, 3, 5, 7]]