educative.io

Recursive call sequence

we see in the chapter about “Recursion” the recursive call prints a sequence of 5 to 0 to 5, then why here in “Exercise: The Factorial!” the Multiplication stops after reaching 5 and not continue Multiply again by 4 then 3 etc’?

Hey @zom100

In the recursion lesson, there were two print statements; therefore, it was printing 5 to 0 for the first print statement and then 1 to 5 for the second one. It was for the sake of understanding that how recursion works. You can check by removing the print statements that how recursion is working.

Shaheryaar Kamal | Technical Content Engineer