Questions tagged [assertion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
18
votes
1answer
193 views

Confirm vs Throw

Version 12.2 brought us Confirm and Enclose. What's the point? Is it just that it's a slightly more convenient syntax than ...
2
votes
2answers
155 views

Assert that prints message and aborts computation?

I'd like to add asserts which check for condition, print useful message and abort computation on failure. IE, ...
3
votes
1answer
70 views

Improving `$AssertFunction` to always tell what the assertion test resulted in

I really like this form of assertion failure: On[Assert]; Assert[1 + 1 == True]; Assert::asrttf: Assertion test 1+1==True evaluated to 2==True that is neither ...
17
votes
3answers
872 views

stop notebook evaluation when Assert fails

I would like a notebook evaluation to entirely stop when an Assert fails, without quitting the kernel. Is this possible (e.g., by setting ...
2
votes
1answer
341 views

How to get Mathematica to abort the current evaluation if an assertion fails?

I can turn on assertions, but they don't terminate the current evaluation. For example: ...
34
votes
1answer
1k views

which is better, using Assert[] or manual checks on arguments and other computations?

I never used Asserts in Mathematica, but trying to see what advantage they have over just argument check and additional definitions of the function to capture unwanted input. For example, which one ...