I also got it wrong, because I thought what you wanted to do was
overwrite methodChosen - but that is of course not what would happen in
Daniel's code ;-)
Continously reassigning to methodChosen to itself once it has been set
(or in your code: Once it has acquired a value that is Groovy-true)
On 25.07.20 20:55, Daniel Sun wrote:
Hi all,
We always have to check the returning value, if it match some condition,
return it. How about simplifying it? Let's see an example:
```
def m() {
def r = callSomeMethod()
if (null != r) return r
return theDefaultResult
}
```
H
> On 27. Jul 2020, at 5.16, Keegan Witt wrote:
>
> but Kotlin is the only place I've seen a trailing if like that, so maybe
> that's biasing my opinion
Not familiar with Kotlin, but Perl has " ". For example:
```
doSomething() if true
```
But that is quite different from what is proposed
On 27.07.20 12:19, MG wrote:
Hi Jochen,
I assume there is a typo ("?:" -> "?=") in your example, but apart from
that, Groovy-truth prohibits your solution for any method returning a
type which has special Groovy-truth meaning, so what we would need for
general applicability and terseness would b
Hi Jochen,
I assume there is a typo ("?:" -> "?=") in your example, but apart from
that, Groovy-truth prohibits your solution for any method returning a
type which has special Groovy-truth meaning, so what we would need for
general applicability and terseness would be:
def chooseMethod(Strin
On 27/07/2020 02:50, Mikko Värri wrote:
Earlier emails talked about supporting full closure syntax for . Is this still
included? If so, the implicit variable would naturally be the closure parameter (`it`
usually). Would it make sense to use the `it` name even in "plain expression" form,
in