mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-21 10:47:34 -05:00
53 lines
573 B
Plaintext
53 lines
573 B
Plaintext
---
|
|
sidebar_label: chunklist
|
|
description: |-
|
|
The chunklist function splits a single list into fixed-size chunks, returning
|
|
a list of lists.
|
|
---
|
|
|
|
# `chunklist` Function
|
|
|
|
`chunklist` splits a single list into fixed-size chunks, returning a list
|
|
of lists.
|
|
|
|
```hcl
|
|
chunklist(list, chunk_size)
|
|
```
|
|
|
|
## Examples
|
|
|
|
```
|
|
> chunklist(["a", "b", "c", "d", "e"], 2)
|
|
[
|
|
[
|
|
"a",
|
|
"b",
|
|
],
|
|
[
|
|
"c",
|
|
"d",
|
|
],
|
|
[
|
|
"e",
|
|
],
|
|
]
|
|
> chunklist(["a", "b", "c", "d", "e"], 1)
|
|
[
|
|
[
|
|
"a",
|
|
],
|
|
[
|
|
"b",
|
|
],
|
|
[
|
|
"c",
|
|
],
|
|
[
|
|
"d",
|
|
],
|
|
[
|
|
"e",
|
|
],
|
|
]
|
|
```
|