assert
assert(g_expression[ t_formatString [ g_arg1 ] … ] ) ) =>nil
Description
Enables you to insert assertions into the SKILL code, either at the top-level or within a function. It evaluates the expression (g_expression) and returns nil if the expression value is non-nil. Otherwise, throws an error and returns the unevaluated expression.
Arguments
Value Returned
Examples
assert(1 == 1)
=> nil
assert( 1==2 )
=> *ERROR* ASSERT FAILED: (1 == 2)
assert( 1==2 “Assertion failed.” )
=> *ERROR* Assertion failed.
a = 1
b = 2
assert( a==b “Assertion failed. %d is not equal to %d” a b )
=> *ERROR* Assertion failed. 1 is not equal to 2.
Related Topics
Return to top