Skip to main content


Throws an exception if an expression evaluates to false


Device + Agent


Name Type Description
code Expression Squirrel code that can be evaluated to true or false




This function evaluates the passed expression, which can be a function call, a variable assignment or value reading, or any other line of Squirrel code.

If the expression evaluates to false, an exception is thrown: the message "assertion failed" will be logged and the imp or agent will warm boot to restart the code. If this is undesirable behavior, the assert() statement may be embedded in a try... catch structure to trap the exception.

If the expression passed top assert() evaluates to true, no action is taken and code continues to execute with the next line.