confirms that test is True, otherwise throwing an error to the nearest surrounding Enclose.


evaluates info and includes its value in the thrown error if test is not True.


uses the specified tag for any thrown errors.



open allclose all

Basic Examples  (2)

Confirm that an assertion is true:

If the assertion fails, stop evaluation and throw an error to the surrounding Enclose:

Create a function that checks its arguments:

Scope  (3)

ConfirmAssert stops evaluation and returns to the matching Enclose when it throws an error:

info is only evaluated when expr cannot be confirmed:

Create a function that calls ConfirmAssert with a tag so that it can be caught dynamically:

If no tag is given, ConfirmAssert is lexically scoped:

Applications  (1)

Print a message when a failure is detected:

Properties & Relations  (2)

ConfirmAssert can be emulated with ConfirmBy or ConfirmMatch:

ConfirmAssert[f[expr]] is effectively equivalent to ConfirmBy[expr,f] except that it returns Null instead of expr:

Possible Issues  (3)

ConfirmAssert must be given a tag or be within a lexical Enclose:

Untagged ConfirmAssert works by replacing instances of the symbol ConfirmAssert with a tagged variant:

Tagged ConfirmAssert requires an Enclose with a matching tag:

Wolfram Research (2020), ConfirmAssert, Wolfram Language function,


Wolfram Research (2020), ConfirmAssert, Wolfram Language function,


Wolfram Language. 2020. "ConfirmAssert." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2020). ConfirmAssert. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_confirmassert, author="Wolfram Research", title="{ConfirmAssert}", year="2020", howpublished="\url{}", note=[Accessed: 24-July-2024 ]}


@online{reference.wolfram_2024_confirmassert, organization={Wolfram Research}, title={ConfirmAssert}, year={2020}, url={}, note=[Accessed: 24-July-2024 ]}