mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
18 lines
239 B
V
18 lines
239 B
V
fn test_anon_fn_direct_call_with_option() {
|
|
z := true
|
|
a := fn [z] () ?int {
|
|
match z {
|
|
true { return 1 }
|
|
else { return none }
|
|
}
|
|
}()
|
|
b := a or {
|
|
println('failed')
|
|
return
|
|
}
|
|
|
|
println('b: ${b}')
|
|
println(a)
|
|
assert b == 1
|
|
}
|