Assertions in design by contract: Difference between revisions
julia example
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: plural) |
(julia example) |
||
Line 204:
}
(...)</lang>
=={{header|Julia}}==
The @assert macro is used for assertions in Julia.
<lang julia>function volumesphere(r)
@assert(r > 0, "Sphere radius must be positive")
return π * r^3 * 4.0 / 3.0
end
</lang>
=={{header|Kotlin}}==
|