Question about recursion

Is there any way to terminate the recursion and come of the recursive function if the desired result is obtained in between? Like break in loops.

@vinay86048,

you can put a boolean value as argument and return from the base condition if the answer is achieved. It is not advised to do so though.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.