Files

14 lines
313 B
Plaintext
Raw Permalink Normal View History

2026-10-26 10:14:11 -05:00
# A pre-condition that fails stops the program, saying what it checked and
# what its operands held.
import std::io;
def divide(a: i64, b: i64): i64 {
expects(b != 0);
ensures(q: q * b + a % b == a);
return a / b;
}
def main(): void {
io::println($"{divide(7, 2)}");
io::println($"{divide(7, 0)}");
}