14 lines
267 B
Text
14 lines
267 B
Text
val .div = fn(.x, .y) {
|
|
[.x / .y, true]
|
|
catch {
|
|
if _err'msg -> re/division by 0/ {
|
|
[0, false]
|
|
} else {
|
|
# rethrow the error if not division by 0
|
|
throw
|
|
}
|
|
}
|
|
}
|
|
|
|
writeln .div(3, 2)
|
|
writeln .div(3, 0)
|