DEV Community

loading...

the elvis operator

tonetheman profile image Tony Colston ・1 min read

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
?=

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

Discussion (0)

pic
Editor guide