Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Julia: add custom message in assert?

In Python I can add a custom message to an assertion to help with code development:

assert False, "Expected true"

How can I do the same in Julia?

like image 485
miguelmorin Avatar asked May 17 '26 15:05

miguelmorin


1 Answers

From the documentation:

@assert false "Expected true"

@assert cond [text]

Throw an AssertionError if cond is false. Preferred syntax for writing assertions. Message text is optionally displayed upon assertion failure.

like image 62
miguelmorin Avatar answered May 20 '26 12:05

miguelmorin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!