Return statement

what is the use of return statement in the function

Hello @21051992,
In general terms return statement in the function ends the execution of a function, and returns control to the calling function.
It may be also used to return the value that is evaluated in the function. If we do not return a value from the function then it will only be evaluated inside and remain in its scope. For example below add() function stores the sum in c but does not return c.
add
But now it return the value of c so in simple terms it can be used further.
add

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.