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 / Programming / Pattern Matching  /
Blank

  • _ or Blank[ ] is a pattern object that can stand for any Mathematica expression.
  • _ h or Blank[ h ] can stand for any expression with head h.
  • The head h in _ h cannot itself contain pattern objects.
  • See the Mathematica book: Section 2.3.1.
  • See also: Pattern, Optional.

    Further Examples

    The blank pattern object can be used in a transformation rule to specify how an expression should be transformed. Here the expression f[ anything ] should be transformed to anything ^2. Since both f[a] and f[b] match this pattern, they are both transformed using this pattern.

    In[1]:=

    Out[1]=