learning-perl6/ch4/ex4-5.raku

15 lines
378 B
Raku
Raw Normal View History

2023-11-23 16:26:32 +00:00
sub MAIN (
$num1, #= Number to perform arithmatic on
$num2 #= Second number to perform arithmatic on
) {
die "unexpected input" unless is-numeric($num1) and is-numeric($num2);
say "sum is {$num1 + $num2}";
say "difference is {$num1 - $num2}";
say "product is {$num1 * $num2}";
say "quotient is {$num1 / $num2}";
}
sub is-numeric ($num) {
return val($num) ~~ Numeric;
}