14 lines
257 B
Text
14 lines
257 B
Text
val dz = 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 dz(3, 2)
|
|
writeln dz(3, 0)
|