Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 12
    Quite true. Of course if the loop is so big and complex that it's difficult to see what's happening inside it, that's a problem whether you have a break or not. Commented Dec 30, 2013 at 15:18
  • 2
    Another issue is that break and continue cause problems with refactoring. This might be a sign that this is a bad practice. The intent of the code is also clearer when using if statements. Commented Jan 19, 2015 at 16:36
  • Those "well-named function call(s)" can be locally-defined lambda functions instead of externally-defined private functions that won't be used elsewhere. Commented Sep 16, 2015 at 13:12
  • I always say: if you're function is small, there is no such thing as an early return. This also counts for loops and breaks, I guess. Commented Dec 20, 2021 at 9:44