OxL Reference

kw for

Reserved keyword

The list of words: §1.4

Syntax

ebnf
Impl        = "impl" [ Type "for" ] Type "{" { ImplMember } "}" ;
ebnf
Provide     = "provide" Type "=" Expr [ "for" "role" IdentList ] ;
ebnf
For         = [ Label ":" ] [ "inline" ] "for" [ "await" ] Pattern "in" Expr [ "where" Expr ] Block ;

Grammar: App. A

Defined in

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

oxl
@retain(ORDER_EVENTS_RETENTION)
topic OrderEvents: OrderEvent sharded by .userId

emit OrderEvents(e)                                       // publication
for await e in OrderEvents.subscribe(key: uid, from: .Latest) { … }
for await e in OrderEvents.subscribe(group: "indexer") { index(e) }

— 10.5 Topics — cluster-wide fan-out

Related diagnostics

break-value, outside-loop, explicit-interface, interface-not-satisfied, yield-outside-stream, topic-without-journal

See also