Sayed's Blog

minerva > docs > users > examples > factorial

Factorial

function factorial(num: Int) => 
    match(num) => {
        0 => 1;
        else => num * factorial(num-1);
    };

print factorial(5); // 120
    © 2023