RosettaCodeData/Task/Detect-division-by-zero/Raku/detect-division-by-zero-1.raku
2023-07-01 13:44:08 -04:00

12 lines
208 B
Raku

sub div($a, $b) {
my $r;
try {
$r = $a / $b;
CATCH {
default { note "Unexpected exception, $_" }
}
}
return $r // Nil;
}
say div(10,2);
say div(1, sin(0));