enum.each_slice(n) { ... } â nil
enum.each_slice(n) â an_enumerator
enum.each_slice(n) â an_enumerator
Instance Public methods
Iterates the given block for each slice of <n> elements. If no block is given, returns an enumerator.
(1..10).each_slice(3) { |a| p a } # outputs below [1, 2, 3] [4, 5, 6] [7, 8, 9] [10]
Please login to continue.