Skip to content

LeafCount

LeafCount[e] returns the count of leaves in e.

Attributes[LeafCount] := {Protected}

Simple examples

In[1]:= LeafCount[a + b]
Out[1]= 3
In[2]:= LeafCount[a^2 + b^Factorial[c]]
Out[2]= 8
In[3]:= LeafCount[a]
Out[3]= 1