RosettaCodeData/Task/Detect-division-by-zero/Perl-6/detect-division-by-zero-1.pl6
2019-09-12 10:33:56 -07: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));