Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

ruby array split into groups

a = [1, 2, 3, 4, 5, 6]

a.each_slice(3).to_a

# => [[1, 2, 3], [4, 5, 6]]
 
PREVIOUS NEXT
Tagged: #ruby #array #split #groups
ADD COMMENT
Topic
Name
6+7 =