Assertions in design by contract: Difference between revisions

(julia example)
Line 281:
in block <unit> at contract.p6 line 14
</pre>
 
=={{header|Phix}}==
User defined types can be used to directly implement design by contract, and disabled by "without type_check".
<lang Phix>type hour(object x)
return integer(x) and x>=0 and x<=23
end type
hour h
h = 1 -- fine
h = 26 -- bad</lang>
{{out}}
<pre>
C:\Program Files (x86)\Phix\test.exw:6
type check failure, h is 26
</pre>
Type check failures can also be caught and processed just like any other exception.
 
=={{header|Racket}}==
7,815

edits