Production code: a division that throws on a zero divisor
The complete source of testing_assertions.ek9, compiled by the EK9 compiler. Shown on testing.html.
#!ek9 defines module site.testing.assertions defines function checkedDivide() as pure -> dividend as Integer divisor as Integer <- quotient as Integer? //Integer division by zero does not throw: it gives an unset Integer. //So a function that must fail says so explicitly. if divisor == 0 throw Exception("division by zero") quotient: dividend / divisor