groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bahman Movaqar <bah...@bahmanm.com>
Subject Re: About if statement in the right hand of assignment statement
Date Wed, 27 Sep 2017 04:24:04 GMT
Yay! It's one of the top items on my wish list :-)
IMHO it helps write cleaner and easier to read code --no ugly
intermediate variables set to `null`. It'd be great if we could have
the same approach for `for`, `while`, `switch`, `do` and `while`.

That being said, I'm curious: would translating it to a closure call
incur performance penalties?

--
Bahman


On Wed, Sep 27, 2017 at 5:37 AM, Daniel Sun <realbluesun@hotmail.com> wrote:
> Hi all,
>
>       I have been thinking about support some syntax like `def x = if (...)
> { ... } else if (...) { ... } else { ... }`, which will be translated to
> `def x = { if (...) { ... } else if (...) { ... } else { ... } }()`
>
>       Any thoughts?
>
> Cheers,
> Daniel.Sun
>
>
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Mime
View raw message