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



    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.