Match Control
01
Match Expression
The 'match' statement evaluates an expression and executes the code block corresponding to the first matching value. It provides a formal and readable alternative to multiple conditional checks.
spec_manifest.jk
let score = 90
match (score) {
90 => println("Passed")
75 => println("Ok")
default => println("Not in the list")
}
02
Conditional Logic
The 'default' case ensures that the program has a fallback execution path if no other patterns match the provided expression.
spec_manifest.jk
let status = "error"
match (status) {
"success" => println("Operation completed")
"error" => println("System failure detected")
default => println("Unknown status")
}
← Return to Index
Technical Documentation