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

make "return" optional everywhere in a method

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None
    • all

    Description

      Currently it seems that the "return" keyword is only optional for the last statement before the closing brace of a method. It would be nice if it were optional everywhere so that the value of the last expression evaluated is returned. For example,

      myMethod() {
      try

      { return calculateSomething() }

      catch (SomeException e)

      { return calculateSomethingElse() }

      }

      Currently those return keywords are required.

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              mvolkmann R. Mark Volkmann
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: