Mathematica 9 is now available
 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]=



    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.