1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

if a := foo() { syntax for handling optionals

This commit is contained in:
Alexander Medvednikov
2019-10-01 06:33:03 +03:00
parent 56e4ed1e6b
commit 5ba354fa2c
6 changed files with 137 additions and 41 deletions

View File

@ -34,3 +34,11 @@ fn test_option_for_base_type_without_variable() {
println('nice')
println(val2)
}
fn test_if_opt() {
if val := err_call(false) {
assert val == 42
}
assert 1 == 1
println('nice')
}