+1

In this factorial function why using -1

https://www.sololearn.com/learn/Swift/2350/

3/23/2020 1:47:26 PM

Vek

4 Answers

New Answer

+3

If you want to calculate factorial say of 5 and you are starting from 5 then on each iteration the number is decresed by 1 and multiplied by the previous result 5x4x3x2x1 = 120

+2

It is recursion, if you do not understand i suggest you first read about recursion.

+2

Ohh thanks mate

+1

But it's not for loop how it will execute till 120