Skip to content

switch

Control flow

Evaluates the discriminant once. break leaves the switch. No C fall-through; stacked cases share a body.

switch (action) {
case "buy":
case "purchase":
Grant(player);
break;
default:
warn("unknown");
break;
}
NameTypeDescription
actionanyCompared with == to each case.

None.

repeat … until true wrapping if / elseif

Emitted as if / elseif / else inside repeat … until true so break still leaves the switch. Stacked cases share the body. default is the fallback.

switch (action) {
case "buy":
Grant(player);
break;
default:
warn("unknown");
break;
}

Emits:

-- discriminant evaluated once, then if/elseif inside repeat-until-true

match · if · break