Bbetlang

Control flow

Conditionals, loops, break/continue, and matching on sum types.

Conditionals: fr and naw

fr (“for real?”) is if; naw is else. Chain them when you want else-if, and yes, naw fr reads exactly like someone reconsidering out loud.

fr n < 0 {           // if
    bet "neg"
} naw fr n == 0 {    // else if
    bet "zero"
} naw {              // else
    bet "pos"
}

While: vibin

Loop while the condition holds.

vibin i <= 5 { i = i + 1 }

For-each: squad

squad x in coll iterates a collection such as an array or a vec.

squad x in [10, 20, 30] { spill.it(x) }

Break and continue: dip and skip

dip dips out of the loop (break); skip skips this iteration and moves to the next (continue). The names are doing exactly what they say.

Match: vibe

vibe checks the vibe of a moods (sum-type) value and dispatches on it. Matches are exhaustive, so the compiler makes you handle every variant, and the naw arm is the wildcard catch-all for when you’d rather not.

vibe s {
    Circle(r) { bet 3 * r * r }
    Rect(w, h) { bet w * h }
    naw { bet 0 }                 // wildcard
}