function output = recursiveFactorial(n)

    if n < 0
        error('n cannot be negative.');
    elseif n < 2
        output = 1;
    else
        output = n * recursiveFactorial(n - 1);
    end

end