Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-534

Nested closures - variable scope problem

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-5
    • 1.0-JSR-5
    • None
    • None

    Description

      output = "a"
      [1,1,1].each {
      output = output + "b"
      [1,1,1].each

      { output = output + "c" }

      }
      print output

      I expected "abcccbcccbccc" but I get "abbb"

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              jaquino Jonathan Aquino
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: