# Add optional \`if break:\` suite to \`for/while\`

**URL:** <https://discuss.python.org/t/add-optional-if-break-suite-to-for-while/71712>\
**Category:** Ideas\
**Created:** [November 19, 2024, 8:57pm UTC](https://discuss.python.org/t/add-optional-if-break-suite-to-for-while/71712 "2024-11-19T20:57:48Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![tim.one](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/tim.one/32/282_2.png) [@tim.one](https://discuss.python.org/u/tim.one)\
**Post date:** [November 19, 2024, 9:13pm UTC](https://discuss.python.org/t/add-optional-if-break-suite-to-for-while/71712/3 "2024-11-19T21:13:55Z")

</div>

Yes, that’s the kind of thing I sometimes resort to now. Code can, of course, be much more complex than my bare-bones skeleton, and it’s very easy to forget to add `found = True` before _every_ `break`. I’m unsatisfied with that approach in real life.

> [@zware](#):
>
> at the cost of confusion when someone tries `if break:` independent of a loop construct.

Why would they? 😉 They don’t try to use a bare `else:` independent of a loop construct either. Or, if they do, they get a syntax error. Same thing here if they try to use `if break:` independent of a loop construct.

---

_[View the full topic](https://discuss.python.org/t/add-optional-if-break-suite-to-for-while/71712)._
