This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
 BUILT-IN MATHEMATICA SYMBOL Tutorials »| See Also »|More About »

# Level

 Levelgives a list of all subexpressions of expr on levels specified by levelspec. Levelapplies f to the sequence of subexpressions.
• Level uses standard level specifications:
 n levels 1 through Infinity levels 1 through Infinity {n} level only {n1,n2} levels through
• Level gives a list of all "atomic" objects in expr.
• A positive level consists of all parts of expr specified by indices.
• A negative level consists of all parts of expr with depth .
• Level 0 corresponds to the whole expression.
• With the option setting Heads->True, Level includes heads of expressions, and their parts.
• Level traverses expressions in depth-first order, so that the subexpressions in the final list are ordered lexicographically by their indices.
Give all parts at level -1:
Give all parts down to level 2:
Give all parts at levels 0 through infinity:
Give all parts at level -1:
 Out[1]=

Give all parts down to level 2:
 Out[1]=

Give all parts at levels 0 through infinity:
 Out[1]=
Down successive numbers of levels:
Negative levels:
Ranges of levels:
Use different heads at each level:
Including heads:
 Applications   (1)
Find the leaf elements in an expression:
Include heads:
Find unique leaf expressions:
Level always lists parts in the lexicographic order of their indices:
Level by default starts at level 1, so it does not include the whole expression:
New in 1