assert multimethod

Methods

assert(condition:Bool, msg:Str) Source: stdlib.ngs:75
Throws AssertFail with givens message if condition is false

Returns

Unspecified, do not count on this value

Example

my_array=[]
# ... Code that adds elements to my_array ...
assert(my_array.len() > 3, "my_array must have more than 3 elements")  # AssertFail exception, with the given message
assert(condition:Bool) Source: stdlib.ngs:82
Throws AssertFail if condition is false

Returns

Unspecified, do not count on this value

Example

my_array=[]
# ... Code that adds elements to my_array ...
assert(my_array.len() > 3)  # AssertFail exception, with "Assertion failed" message
assert(condition:Any, *args:Arr) Source: stdlib.ngs:90
Throws AssertFail if condition, after conversion to Bool is false. Same as super(Bool(condition), *args) .

Parameters

conditionnot Bool

Returns

Unspecified, do not count on this value

Example

assert(my_array, "my_array must have elements at this point")