Check out example codes for "statement that causes a function to end in c++". It will help you in understanding the concepts better.
Code Example 1
Return statement. The return statement stops execution and returns to the calling function. When a return statement is executed, the function is terminated immediately at that point, regardless of whether it's in the middle of a loop, etc.
Learn ReactJs, React Native from akashmittal.com