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 / Input and Output / Messages  /
On

  • On[ symbol :: tag ] switches on a message, so that it can be printed.
  • On[ s ] switches on tracing for the symbol s.
  • On[ , , ... ] switches on several messages.
  • On[ ] switches on tracing for all symbols.
  • When tracing is switched on, each evaluation of a symbol, on its own, or as a function, is printed, together with the result.
  • Note that the tracing information is printed when a function returns. As a result, traces of recursive functions appear in the opposite order from their calls.
  • On[ s ] is equivalent to On[ s ::trace].
  • On[ ] is equivalent to On[ s ::trace] for all symbols.
  • See the Mathematica book: Section 1.3.11Section 2.8.21.
  • See also: Off, TracePrint.

    Further Examples

    This switches on tracing of all symbols.

    In[1]:=

    On::trace: On[] --> Null.

    In[2]:=

    Set::trace: a = 5 --> 5.

    Out[2]=

    In[3]:=

    a::trace: a --> 5.

    2 2
    Power::trace: a --> 5 .

    2
    Power::trace: 5 --> 25.

    2
    Plus::trace: a - c --> 25 - c.

    2
    b::trace: b[a - c] --> b[25 - c].

    Out[3]=

    This switches tracing off.

    In[4]:=