3 ms·
You could read it as "either process all of these elements, or otherwise do this other thing". If we break, we're not processing all of the elements (the normal
by ptx 5y ago
You could read it as "either process all of these elements, or otherwise do this other thing". If we break, we're not processing all of the elements (the normal case), so we do the "else" part instead.
Edit: This is wrong. See replies.
- 63 5y agoThat would make total sense if it were correct. That's exactly how I think most people would intuit it However, that's exactly how it doesn't work and that's my point. The else clause is only ran if the loop DOESN'T break.
- ptx 5y agoHmm! Yes, you're right. Even though I knew exactly how it works and I sometimes use it, I still got confused, so maybe it is a confusing feature after all. :)