RosettaCodeData/Task/Detect-division-by-zero/Langur/detect-division-by-zero.langur
2024-07-13 15:19:22 -07:00

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)