disable/enable_asserts


disable_asserts()
enable_asserts()          
      

Disable/enable assertions dynamically. Return void.

The assert statement is a powerful debugging tool. Using this statement you can tell the program to test if an expression meets a condition and if not to raise an exception.

When assertions are disabled, failed assertions will all return true.

Examples:


assert 1 < 2 
assert 10 > 20
//> error: assertion_failed line: 1
disable_asserts()
assert 10 > 20
// true
      

Assert can be asked to print an alternate error message:


assert 1 > 2, "We have a problem!"
//> error: We have a problem!
      
g

Core Module Index | Contents