RosettaCodeData/Task/Assertions/BASIC256/assertions.basic

7 lines
281 B
Plaintext

subroutine assert (condition, message)
if not condition then print "ASSERTION FAIED: ";message: throwerror 1
end subroutine
call assert(1+1=2, "but I don't expect this assertion to fail"): rem Does not throw an error
rem call assert(1+1=3, "and rightly so"): rem Throws an error