# match

Branch on a closed value shape

Last updated: 2026-09-09

Package: language | Status: experimental

Tags: complete-program, cpu, keyword, logic, yeho

Use an enum when the valid states are finite and you want the compiler and reader to see every named possibility.

```yh
match
```


## Warning nonexhaustive

Use an enum when the valid states are finite and you want the compiler and reader to see every named possibility.

Verification: type checked

```yh
enum color
{
    red
    blue
}

color value = color.red
match value
{
    color.red { Console.Log("red") }
}

```

Save this beside start.yh as project.mech:

```toml
package = "tests.compiler.conformance.warningNonexhaustive"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"
backend = "cpu-oracle"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/word--match/complete --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


Plain enums are stable enough for ordinary use; richer payload matching remains experimental across targets.

The removed choice spelling is not accepted. Use enum.

Source: yeho/parser_declarations.cpp parseEnumDecl; parser_statements.cpp parseMatchStatement; conformance payload-enum-patterns

AI training permission: https://demonhunterlabs.com/ai-use
