> for (goo(); a>6 && it>10;) {return} Actually my first take on the macro implementation was to create a for statement because it provides a scope for a temp variable and supports a statement. Then I discovered that macro methods must return an expression...
-----Original Message----- From: Jochen Theodorou <blackd...@gmx.org> Sent: Thursday, July 30, 2020 3:27 AM To: dev@groovy.apache.org Subject: Re: [PROPOSAL]Support conditional return On 30.07.20 01:10, Daniel Sun wrote: > Hi mg, > > I like your idea, but it's hard for IDE to infer the type of `it` > during we coding. > > ``` > returnIf(a > 6 && it > 10) { goo() } > ``` long time ago I made the suggestion of a ClosureList based on the classic for: "(" expr (";" expr)+ ")". It got shot down very much for being so ugly, but using that, we would get this: ``` retunIf (goo(); a>6 && it>10) ``` of course going crazy we could move this further: ``` for (goo(); a>6 && it>10;) {return} ``` or ``` for (goo(); a>6 && it>10; return) ``` bye Jochen