OxL Reference

kw break

Reserved keyword

The list of words: §1.4

Syntax

ebnf
Primary     = Literal | Path | "it" | "self" | "(" Expr { "," Expr } ")" | ListLit | MapLit
            | StructLit | Lambda | Block | If | Match | For | While | Loop | Scope | Select | Query
            | "spawn" ( Postfix | Block ) | "await" Unary | "atomic" [ "(" Args ")" ] Block
            | "return" [ Expr ] | "fail" Expr | "yield" Expr | "respond" Expr | "break" [ Label ] [ Expr ]
            | "continue" [ Label ] | "emit" Path "(" Expr ")" | "unsafe" Block | "blocking" Block
            | "comptime" Block | "." Ident [ "(" [ Args ] ")" ] ;

Grammar: App. A

Defined in

  • 5.6 Loops — for accepts Iterable<T> (including iter<T>, collections, ranges); for await accepts Streamable<T>.
  • 1.3 Identifiers — Identifier: XID_Start | "_", then XID_Continue* (Unicode UAX #31).
  • 1.4 Keywords — Reserved (cannot be used as names)

Examples

oxl
for u in users { … }
for (i, u) in users.enumerate() { … }
for i in 0..n where i % 2 == 0 { … }      // filter
for await msg in input { … }               // stream<T>
while cond { … }
while let x? = queue.pop() { … }
loop { if done { break result } }          // loop is an expression
'outer: for a in xs { for b in ys { if a == b { break 'outer } } }

— 5.6 Loops

Related diagnostics

break-value, outside-loop, bad-label

See also