Concept Flow - Return inside loops
Start function
Enter loop
Check condition
Yes
Return value?
Yes→Exit function immediately
No
Continue loop
Loop ends
→Return after loop or undefined
The function starts and enters a loop. If a return is hit inside the loop, the function exits immediately. Otherwise, the loop continues until done.