Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-beta-8
-
None
Description
i=5;
print i;
[1, 2, 3].each {
item |
int i=0;
i+=item;
print item;
print i;
};
print i
this example code should print 51122335 but prints 51122333. So the i in the closure is different from the i outside when inside the closure but leaving the closure the outer i will be overwritten with the inner i. As there are different scopes the outer i should still contain the old value.
Attachments
Issue Links
- is depended upon by
-
GROOVY-754 scoping
- Closed