Mega Code Archive
Categories
/
Ruby
/
Range
Each_slice loop with range
(1..10).each_slice(4) {|x| print x } # Prints "[1,2,3,4][5,6,7,8][9,10]"