Function assert()

← Back to Module core



Module core → assert()

Description

This function is a debugging aid that tests whether a condition is true. If condition is false, it prints the error message and halts the programme's execution

assert(condition, message = "")


Parameters


Return Value


Usage Example

x = 20
y = 10
 
assert(x > 15)                                  ' Assertion passed, programme continues
assert(y > 15, "y should be greater than 15")   ' Assertion error: y should be greater than 15