About function return statement

i dont understand why loop terminates when we encounter return statement while printing all prime. so help me to solve my doubt

hello @manoj2597 as the name suggest return is the statement which is used in the function to return to there from where the call was generated .
this happens because when the return is encounutered in the program it tells us that the our work is done and now you can return there is no need for further executions .

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.