WLJS LogoWLJS Notebook

Flatten

Flatten[list] flattens out nested lists.

Flatten[list, n] flattens to level n.

Examples

Completely flatten a nested list:

Flatten[{{a, b}, {c, {d, e}}}]
(* {a, b, c, d, e} *)

Flatten only one level:

Flatten[{{a, b}, {c, {d, e}}}, 1]
(* {a, b, c, {d, e}} *)

Please visit the official Wolfram Language Reference for more details.

On this page