assert
Syntax Format
assert(condition[, message])
Overview
The assert
function stops the script execution if the condition is false. Emits the error message to log. The function is useful for debugging.
Parameters
Parameter | Type | Purpose |
---|---|---|
condition | boolean | A condition to assert on |
message | string | An optional error message |
Example
value = -1
assert(value > 0, "The value is not a positive number")