Skip to main content


A match expression works almost identically to a switch except that it does not support fallthrough or a break keyword. Multiple case labels are allowed though.

The value type can be anything, though if the value type is not a numeric or enum value then internally the match statement will compile down to an if-else ladder and may perform marginally slower than the optimizable integer/enum version.

template MatchSample(required int value) render {

match(value) {

case 0: {
Text("show if value is 0");

case 99:
case 100: {
Text("show if value is 100");

default: {
Text("show if nothing matched");