@lang:flat
Flatten one level of nesting in an array.
On-chain (@lang:flat!): Flattens runtime nested arrays or a literal list of compatible array parts, preserving element types.
Returns: array
Syntax
Section titled “Syntax”@lang:flat(arr)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
arr | array | Source array of arrays |
See Also
Section titled “See Also”On-chain face (@flat!)
Section titled “On-chain face (@flat!)”Flatten arrays by one level while preserving element order and type. Constant and live parts can be mixed, and any number may be live: the core gathers each one once into the values list.
Literal parts also support strings, bytes, tuples, and nested arrays. When mixed
with a live typed array, literals inherit its element type; otherwise all literal
parts are inferred together. Empty parts inherit their siblings' type, with
uint256[] as the fallback when every part is empty.