WLJS LogoWLJS Notebook

Depth

Depth[expr] gives the maximum number of indices needed to specify any part of expr, plus 1.

Examples

Depth of expressions:

Depth[{a, b, c}]
(* 2 *)

Depth[{{1, 2}, {3, 4}}]
(* 3 *)

Depth[x]
(* 1 *)

Please visit the official Wolfram Language Reference for more details.

On this page