mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
17 lines
176 B
V
17 lines
176 B
V
fn f() ?int {
|
|
return none
|
|
}
|
|
|
|
fn test_option_if_expr() {
|
|
i := f() or {
|
|
if err is none {
|
|
int(0)
|
|
} else {
|
|
eprintln(err)
|
|
int(-1)
|
|
}
|
|
}
|
|
println(i)
|
|
assert i == 0
|
|
}
|