This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / Lists and Matrices / List Testing  /
Length

  • Length[ expr ] gives the number of elements in expr.
  • See the Mathematica book: Section 1.4.7, Section 1.8.3Section 2.1.5.
  • Length[ expr ] returns 0 whenever AtomQ[ expr ] is True.
  • See also: LeafCount, ByteCount, Depth.

    Further Examples

    This list has four elements.

    In[1]:=

    Out[1]=

    This expression has length two.

    In[2]:=

    Out[2]=

    In[3]:=

    Out[3]//FullForm=

    This gives the number of digits in 1000!.

    In[4]:=

    Out[4]=