Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion content/docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down