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

operator precedence in print and inject()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 1.0-beta-5
    • 1.0-beta-6
    • None
    • None

    Description

      I had to use () to get the expected result, as shown below:

      1> print( [1, 2, 3].inject(0)

      { c, s | c + s })
      2> /
      6
      1> print [1, 2, 3].inject(0) { c, s | c + s }

      2> /
      null

      1> x = [1, 2, 3].inject(0)

      { c, s | c + s }

      ; println x
      2> /
      6

      Attachments

        Activity

          People

            Unassigned Unassigned
            bingran Bing Ran
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: