Assertions in design by contract: Difference between revisions
→{{header|FreeBASIC}}: -expand
(add FreeBASIC) |
(→{{header|FreeBASIC}}: -expand) |
||
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(
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}}==
|