33 lines
329 B
V
33 lines
329 B
V
fn match_expr() {
|
|
a := 10
|
|
match a {
|
|
10 { println('10') }
|
|
20 { println('20') }
|
|
else {}
|
|
}
|
|
}
|
|
|
|
fn match_expr_assignment() {
|
|
a := 20
|
|
_ := match a {
|
|
10 { 10 }
|
|
5 { 5 }
|
|
else { 2 }
|
|
}
|
|
}
|
|
|
|
fn match_branch_comment() {
|
|
a := 1
|
|
match a {
|
|
1 {
|
|
println('1')
|
|
}
|
|
2 {
|
|
println('2')
|
|
}
|
|
else {
|
|
// do nothing
|
|
}
|
|
}
|
|
}
|