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

17 lines
229 B
V

fn test_anon_functions_can_have_loops_with_breaks() {
mut res := 123
for true {
x := fn () int {
for x in 0 .. 10 {
println(x)
break
}
return 3
}()
println('${x}')
res = x
break
}
assert res == 3
}