programming-examples/perl/Subroutine/Write recursive subroutines.pl
2019-11-15 12:59:38 +01:00

11 lines
208 B
Raku

sub Factorial {
my($n) = @_;
$n <= 2 and return $n;
return $n * Factorial($n-1);
}
for $i (1..9) {
print "$i Factorial =\t", Factorial($i), "\n";
}