OxL Reference

kw else

Reserved keyword

The list of words: §1.4

Syntax

ebnf
ClusterClause = "seeds" Expr | "port" IntLit | "trace_sample" FloatLit | "auth" Block | "defaults" "{" { Ident Expr } "}"
            | "role" Ident "{" RoleClause { ( ";" | NL ) RoleClause } "}"
            | "assign" "by" Expr { "else" Expr } ;
ebnf
If          = "if" ( Expr | "let" Pattern "=" Expr ) Block [ "else" ( If | Block ) ] ;
ebnf
SelArm      = ( "recv" Pattern "from" Expr | "send" Expr "to" Expr | "after" Expr | "else" ) "=>" Expr ;

Grammar: App. A

Defined in

Examples

oxl
let (tx, rx) = chan<Job>(cap: JOB_QUEUE)

select {
  recv job from rx  => process(job)
  send r to results => sent += 1
  after IDLE_TIMEOUT => log.info("idle")
  else              => tick()          // non-blocking variant
}

— 8.7 Channels and select

oxl
let kind = if n < 0 { "neg" } else if n == 0 { "zero" } else { "pos" }
if let User{ role: .Admin, name, .. } = u { greet(name) }
if x is Receipt { save(x) }          // x is narrowed to Receipt

— 5.4 Conditions

Related diagnostics

actor-not-hosted, cluster-auth, cluster-decl, cluster-needs, cluster-seeds, placement-conflict, saga-without-role, service-not-served, topic-without-journal, unknown-role, bound-not-satisfied, generic-args

See also