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

25th Jul 2017, 2:21 PM
Owolawi Kehinde
Owolawi Kehinde - avatar
1 Resposta
+ 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".
25th Jul 2017, 3:51 PM
Rrestoring faith
Rrestoring faith - avatar