Skip to content

List Chunk

The list::chunk function splits a list into smaller chunks of a specified size.

Syntax

list::chunk(<list>, <chunk-size>)

Parameters

  • list: The input list to be divided into chunks.
  • chunk-size: The size of each chunk (must be a positive integer).

Returns

  • List of Lists: A list where each element is a chunk of the original list.

Example

Try it out below!
list::chunk([1, 2, 3, 4, 5, 6], 2)

This function is useful for dividing data into manageable pieces for processing or display.