Docs / Expressions
4.6 Control Expressions & Match
The 'match' statement provides robust functional branching through pattern matching. It supports matching against constants (numeric literals, boolean literals, or strings) and the discard wildcard character (_), as well as allowing boolean sentences as structural guards.
Conditional Verification via Pattern Matching
1 let status = 404; 2 3 let mensagem = match status { 4 200 => "Success", 5 404 => "Not Found", 6 _ => "Unknown error" // Wildcard required to cover all other states 7 }; 8 9 // Example with Additional Conditions (Guards!) 10 let numero = 15; 11 match numero { 12 val => val > 10 && val < 20 => io_write_file("saida", "Variable is in the middle range"), 13 _ => io_write_file("saida", "Out of scope") 14 };
'Match' expressions return the result of the selected expression directly for local assignment.
Found an error in the spec? Open a PR.
Official Version: 1.0 · May 2026