v/vlib/v/checker/tests/optional_or_block_returns_v...

17 lines
300 B
V

fn test_optional(fail bool) ?string {
if fail {
return error('false')
}
return 'fff'
}
fn main() {
// a := test_optional(false) or { println(err) }
test_optional(true) or {
// must be of the same type of the return
// type of the `test_optional` function
123
// 'I break things'
}
}