Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
nested_anonfunc_and_for_break_test.v
16
lines
·
16
sloc
·
229 bytes
·
017ace6ea7402430a992aa0820d5e472ebca74c7
Raw
1
fn
test_anon_functions_can_have_loops_with_breaks() {
2
mut
res := 123
3
for
true
{
4
x :=
fn
() int {
5
for
x
in
0 .. 10 {
6
println(x)
7
break
8
}
9
return
3
10
}()
11
println(
'${x}'
)
12
res = x
13
break
14
}
15
assert res == 3
16
}
17