Assertions in design by contract: Difference between revisions

(add FreeBASIC)
Line 109:
Finally, <code>assertwarn</code> is like <code>assert</code> but only prints an error message and continues running:
<lang freebasic>'compile with the -g flag
dim as integer a = 2
assertwarn( 2a+2a=5 )
print "Ha, no."</lang>
 
All three show the line number of the failed assertion and the expression that failed, making these nicely self-documenting.
 
<pre>
assert.bas(3): assertion failed at __FB_MAINPROC__: a+a=5
Ha, no.
</pre>
 
=={{header|Go}}==
781

edits