Quick actions

cmd+k|ctrl+k

Navigation

Languages

test

Snippet info

Language

Raku

Visibility

unlisted

Author

legacy-anonymous

Created

2020-05-07T18:05:15Z

Updated

2020-05-07T18:05:15Z

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