My my factorial functions return 1 for any negative value

Why my Factorial functions return 1 for any negative value always?

my_factorial(n::Integer)::BigInt = reduce(*, BigInt(1):BigInt(n))

When n is negative, the range is empty, and reduce(*,) starts with the multiplicative identity which is 1.

4 Likes