evaluates expr, and returns the result, unless messages were generated, in which case it evaluates and returns failexpr.


checks only for the specified messages.


checks only for messages in the named message group.


  • Check has attribute HoldAll.
  • Check does not test for messages that have been switched off using Off, or by uses of Quiet that occur inside it.
  • The operation of Check is not affected by being enclosed inside Quiet.
  • In Check[expr,failexpr,"name"], possible named message groups are given by $MessageGroups.
  • Explicit message names of the form s::t can be mixed with named message groups.


open allclose all

Basic Examples  (2)

Return err when a message is generated:

Check only for specific messages:

Applications  (1)

Use Check and Quiet to provide values for arguments where a function is not applicable:

This function simply returns its argument if its argument is a string of length less than four:

Without the Check and Quiet, the middle input would have returned unevaluated with a message:

Properties & Relations  (2)

Check does not prevent messages from being issued:

Check does not detect messages suppressed with a inner Quiet:

However, the operation of Check is not affected by being inside Quiet:

Possible Issues  (1)

A nested Check does not silence a message for an enclosing Check:

Use an intermediate Quiet to prevent the enclosing Check from reacting to the message:

Wolfram Research (1988), Check, Wolfram Language function, (updated 2008).


Wolfram Research (1988), Check, Wolfram Language function, (updated 2008).


Wolfram Language. 1988. "Check." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2008.


Wolfram Language. (1988). Check. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_check, author="Wolfram Research", title="{Check}", year="2008", howpublished="\url{}", note=[Accessed: 21-July-2024 ]}


@online{reference.wolfram_2024_check, organization={Wolfram Research}, title={Check}, year={2008}, url={}, note=[Accessed: 21-July-2024 ]}