What is the purpose of return?

we are taught that as we use return , we go the main code but now you are saying that when n==0 , it will start coming back and will print value of n … It confused me a little that when cout will be called? because before that we are using recursion and at n==0 we used return

@dhirenkinha hey ,return statement se control wha return hoga jha se function call hua hai,yha recursion use horhi hai to ek recursion khtm pr control purani function call pr jayega.

achaa ohkkk…phir n ki value bhad kaise rhi h agar n=0 aane par return kardiya hamne aur control purane function pe aagya

@dhirenkinha hey ,ye n==0 wala base case hai iska mtlb ye hai ki recursion ko ye terminate krega ,hm recursion me har function call me nko reduce krke bhej rhe hai ,aur ye tab tk hogi jab tk n 0 nhi ho jata ,jab n=0 hoga to ye wala base case chl jayega and woh us function se return hokr wha chla jayega jha se ye recursion call hui thi ,base condition dalni pdti hai warna recursion call hoti hi rhegi usko rokne ke lie dalte hai.

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.