Jun 2025 (v0.3.3)
Mochi v0.3.3 adds pattern matching and logical operators, expanding the language's expressiveness for control flow and boolean logic.
Pattern Matching
A new match expression evaluates a target value against a series of patterns and returns the result of the first match. An underscore _ matches any remaining cases.
let label = match x {
1 => "one"
2 => "two"
_ => "other"
}
Match expressions can appear anywhere an expression is allowed, including inside functions and variable declarations.
Logical Operators
Boolean expressions now support && (and) and || (or) with proper precedence.
if a && b || c {
print("combined condition")
}
These operators integrate with the type checker and interpreter just like other binary operators.