powered by
Throw error if condition false
assert(cond, msg = "Assertion failed.", A = NULL)
The error message if cond == FALSE, nothing otherwise
cond == FALSE
Logical test
Error message to be displayed if cond == FALSE
values to format msg if the latter contains C-style formatting commands. formatted as parsable
msg
Waldir Leoncio
minVal <- 7 x <- 26 assert(minVal < x) # should return nothing maxVal <- 13 if (FALSE) { assert((minVal < x) && (x < maxVal)) assert(x == "a", "x is %s", class(x)) }
Run the code above in your browser using DataLab