0
what does it mean when they say 'the base case acts as the exit condition for the recursion?
Because from what i can see a recursion isnt a loop, why will it need an exit condition. I dont really understand
1 Respuesta
+ 2
Recursion is basically a loop. The function is calling itself. If you don't exit somewhere it will keep calling itself indefinitely.
The base case is just a condition (Most often an if statement) so the recursion is no longer infinite.
*It may also be called the "easy case".