Control flow

Meta: keep if, case, and for close together — they're all expression-form. The "no statements vs. expressions" point is worth stating once at the top.

Everything is an expression

if / else

pub status = if (active) { "on" } else { "off" }

case

case (value) {
  1 => "one"
  2 => "two"
  else => "?"
}

Value patterns

Type patterns

case (animal) {
  c: Cat => c.purr
  d: Dog => d.bark
}

Optional operand

for

for (i < 10) { i += 1 }   # loops while condition is Boolean! true
for { ... break ... }     # infinite; exit via break/return

break and continue

return

try / catch / raise