mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
14 lines
200 B
V
14 lines
200 B
V
type Ty = bool | int
|
|
|
|
fn test(a bool) Ty {
|
|
return match a {
|
|
true { 123 }
|
|
else { false }
|
|
}
|
|
}
|
|
|
|
fn test_match_expr_sumtype_eval() {
|
|
assert test(true) == Ty(123)
|
|
assert test(false) == Ty(false)
|
|
}
|