Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

can not access fields from loop #40

Closed
h1romas4 opened this issue Feb 14, 2015 · 2 comments
Closed

can not access fields from loop #40

h1romas4 opened this issue Feb 14, 2015 · 2 comments

Comments

@h1romas4
Copy link

class Test {
    def field1 = 0
    def field2 = 0
    Test() {
        // OK
        (1..10).each {
            field1 += it
        }
        println field1
        // ReferenceError: "field2" is not defined.
        for(def i = 1; i <= 10; i++) {
            field2 += i
            // OK
            // this.field2 += i
        }
        println field2
    }
}

new Test()

Grooscript is great! Thank you.
Best regards.

@chiquitinxx
Copy link
Owner

Thank you! With your help is more great :)

@h1romas4
Copy link
Author

I try grooscript-1.0.1-SNAPSHOT. Good work.
Thank you very much! I keep Grooscript-ing!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants