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

"none" keyword for optionals + more memory fixes

This commit is contained in:
Alexander Medvednikov
2019-09-17 22:41:58 +03:00
parent e40ab547ba
commit d1500511e6
12 changed files with 273 additions and 204 deletions

View File

@ -16,9 +16,21 @@ fn err_call(ok bool) ?int {
return 42
}
fn ret_none() ?int {
//return error('wtf') //none
return none
}
fn test_option_for_base_type_without_variable() {
val := err_call(true) or {
panic(err)
}
assert val == 42
println('hm')
val2 := ret_none() or {
println('yep')
return
}
println('nice')
println(val2)
}