add perl6 code for chapters 1-4 (#49)
This commit is contained in:
7
03_recursion/perl6/03_factorial.p6
Executable file
7
03_recursion/perl6/03_factorial.p6
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env perl6
|
||||
use v6.c;
|
||||
|
||||
multi fact(1) { 1 }
|
||||
multi fact($x where { $x > 1 }) { $x * fact($x-1) }
|
||||
|
||||
say fact(5);
|
||||
Reference in New Issue
Block a user