This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)


represents a rule that transforms lhs to rhs.
  • The character can be entered as Esc -> Esc or \[Rule].
  • evaluates rhs immediately.
  • You can apply rules using Replace.
  • The assignment specifies that the rule should be used whenever it applies.
  • Symbols that occur as pattern names in lhs are treated as local to the rule. This is true when the symbols appear on the right-hand side of conditions in lhs, and when the symbols appear anywhere in rhs, even inside other scoping constructs.
  • Rule constructs can be nested in any way. Rule is treated as a scoping construct, so that inner variables are renamed if necessary.
Use a rule that replaces by 3:
Use a rule that replaces by 3:
Click for copyable input
Any expression or pattern can appear in a rule:
evaluates when it is first entered; when it is used:
groups to the right:
New in 1 | Last modified in 3