DEV Community

Tony Colston
Tony Colston

Posted on

the elvis operator

I was reading through Groovy 3.0 release notes

https://groovy-lang.org/releasenotes/groovy-3.0.html

Lots of stuff but what caught my eye was the elvis operator

// original elvis operator
?: 

// shortened elvis operator
?=
Enter fullscreen mode Exit fullscreen mode

Looks longer to me. :)

More on the elvis operator here at wikipedia if you have not encounter such a thing before: https://en.wikipedia.org/wiki/Elvis_operator

Top comments (0)