Jump to content

Assertions: Difference between revisions

Added BASIC256
No edit summary
(Added BASIC256)
Line 205:
Now, expect a failure, unless NDEBUG defined at compile time
41</pre>
 
=={{header|BASIC256}}==
{{works with|BASIC256|2.0.0.11}}
<lang BASIC256>
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
</lang>
 
=={{header|BBC BASIC}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.