Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / Input and Output / Messages  /
Check

  • Check[ expr , failexpr ] evaluates expr, and returns the result, unless messages were generated, in which case it evaluates and returns failexpr.
  • Check[ expr , failexpr , :: , :: , ... ] checks only for the specified messages.
  • Check has attribute HoldAll.
  • Check tests only for messages that are actually output. It does not test for messages that have been suppressed using Off.
  • See the Mathematica book: Section 2.8.21.
  • See also: MessageList, $MessageList, Message, Indeterminate, TimeConstrained, CheckAbort.

    Further Examples

    Evaluating 0^0 produces a message, so the second argument of Check is returned.

    In[1]:=

    0
    Power::indet: Indeterminate expression 0 encountered.

    Out[1]=

    In[2]:=

    Log::argt: Log called with 3 arguments; 1 or 2 arguments are expected.

    Out[2]=



    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.