language · keyword ·
with
Bind a match payload
Use an enum when the valid states are finite and you want the compiler and reader to see every named possibility.
withStatus: experimental
Complete program
Bind the explanation carried by a failed result and display it.
cpu · language · type checked
enum Result
{
Ready,
Failed(text reason)
}
Result result = Result.Failed("The player name is missing")
match result
{
Result.Ready { Console.Log("Ready") }
Result.Failed with reason { Console.Log(reason) }
else { Console.Log("Unknown result") }
}
project.mech
manifestVersion = "2"
package = "api.example.word__with"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"
[app]
kind = "headless"
Notes and source
Plain enums are stable enough for ordinary use; richer payload matching remains experimental across targets.
The removed choice spelling is not accepted. Use enum.
yeho/parser_declarations.cpp parseEnumDecl; parser_statements.cpp parseMatchStatement; conformance payload-enum-patterns