Files
grokking_algorithms/03_recursion/perl5/03_factorial.pl
biosta 67291c451f Examples for Chapter 3 written in Perl 5 (#71)
* Create 01_countdown.pl

Recursion example #1 written in Perl 5

* Create 02_greet.pl

Recirsion example #2 written in Perl 5

* Create 03_factorial.pl

Recursion example #3 written in Perl 5
2018-04-29 08:27:14 -07:00

14 lines
154 B
Raku

sub fact {
my $x = shift;
if ( $x == 1 ) {
return 1;
}
else {
return $x * fact( $x - 1 );
}
}
print fact(5), "\n";