diff --git a/content/docs/overview.md b/content/docs/overview.md index d375d476..f2ef8792 100644 --- a/content/docs/overview.md +++ b/content/docs/overview.md @@ -639,7 +639,7 @@ See the [Conditional compilation section](#when-statements) for examples of buil ### Branch statements #### `break` statement -A for loop or a switch statement can be left prematurely with a `break` statement. It leaves the innermost construct, unless a label of a construct is given: +A for loop, conditional, or a switch statement can be left prematurely with a `break` statement. It leaves the innermost construct, unless a label of a construct is given: ```odin for cond { switch { @@ -658,6 +658,13 @@ loop: for cond1 { } } +outer: if cond { + ok := check_something() + if !ok { + break outer // label names are required with conditionals + } +} + exit: { if true { break exit // works with labeled blocks too