Where to use the return statement with a loop?
return in a function means you are leaving the function immediately and returning to the place where you call it. So you should use return when you are 100% certain that you wanna exit the function immediately. In your example, I think you don’t want to exit the function until you get the final value … Read more