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 / Structure Manipulation  /
Order

  • Order[ , ] gives 1 if is before in canonical order, and -1 if is after in canonical order. It gives 0 if is identical to .
  • Examples: Order[a, b]; Order[b, a].
  • Order uses canonical order as described in the notes for Sort.
  • See the Mathematica book: Section 2.2.10.
  • See also: Equal, SameQ, Sort.

    Further Examples

    Mathematica puts lower-case expressions before upper-case expressions that start with the same letter.

    In[1]:=

    Out[1]=

    Shorter expressions come before longer expressions.

    In[2]:=

    Out[2]=