test
sub factorial(Int $x) {
if $x < 0 {
die "Cannot have factorial of negative number!"
} elsif $x = 0 || $x = 1 {
return 1
} else {
return $x*factorial($x-1)
}
}
put factorial(9);INFO
sub factorial(Int $x) {
if $x < 0 {
die "Cannot have factorial of negative number!"
} elsif $x = 0 || $x = 1 {
return 1
} else {
return $x*factorial($x-1)
}
}
put factorial(9);