For loop contains an unconditional return
- return
- for-loop
- newbie
The asker is surprised that their for
loop containing a return
statement exits after one iteration. This may be due to an indentation error, or a misunderstanding of what return
does. The asker may be interested in using yield
.