Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-beta-5
-
Fix Version/s: 1.0-JSR-5
-
Component/s: None
-
Labels:None
Description
The following code prints
1
1
it should print
1
2
class Test
{
static void main(args)
{
i = 1 // <--- remove this line and result is correct (1, 2)
c = {
i = 1
println("i = ${i}")
c1 = {
i = 2
}
c1()
println("i = ${i}")
}
c()
}
}
Issue Links
- is depended upon by
-
GROOVY-754
scoping
-
here is another one:
i = 0
1.times {
i++
1.times { i++ println i }
println i
}
print i
I got "1" instead of "2"