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

Conditional Return

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • syntax
    • None

    Description

      I would like to propose a new feature. the Conditional Return.

      void test() {
          // Do Something
          return if [some expression]
          // Do Some More
          return if [some expression]
      }
      

      To me this reads a bit better than

      void test() {
          // Do Something
          if ([some expression]) {
              return
          }
          // Do Some More
          if ([some expression]) {
              return
          }
      }
      

      I highly doubt this will be implemented, but it was just an idea I had.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            kaendfinger Kenneth Endfinger
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: