This is what we call the neutral element of the operation.
This value, $fat = 1
, will always be there regardless of the input value, that is, if we are calculating the factorial of 5 or 345; $fat
will always start with value 1.
Why exactly 1?
Because we need to ensure that this initial value does not interfere in any way with our result, and for this we assign the neutral value of the multiplication as the initial value.
The neutral value, X
, of an operation is that when the operation is performed the result is the other operand. For example, X * A
must be A
so that X
is considered the neutral element. Only if X = 1
the result will be A
, independent of the value of A
.
The same happens with the value 0 when the mathematical operation is the addition, since 0 + A
will always be A
, independent of the value of A
.
In this way, starting $fat = 1
, we guarantee that when $fat = $fat * $c
is executed the result will be $c
independent of the $c
value.