|
|
|
|
@ -1,10 +1,10 @@
@@ -1,10 +1,10 @@
|
|
|
|
|
[[expressions-operator-elvis]] |
|
|
|
|
= The Elvis Operator |
|
|
|
|
|
|
|
|
|
The Elvis operator is a shortening of the ternary operator syntax and is used in the |
|
|
|
|
https://www.groovy-lang.org/operators.html#_elvis_operator[Groovy] language. With the |
|
|
|
|
ternary operator syntax, you often have to repeat a variable twice, as the following |
|
|
|
|
Java example shows: |
|
|
|
|
The Elvis operator (`?:`) is a shortening of the ternary operator syntax and is used in |
|
|
|
|
the https://www.groovy-lang.org/operators.html#_elvis_operator[Groovy] language. With the |
|
|
|
|
ternary operator syntax, you often have to repeat a variable twice, as the following Java |
|
|
|
|
example shows: |
|
|
|
|
|
|
|
|
|
[source,java,indent=0,subs="verbatim,quotes"] |
|
|
|
|
---- |
|
|
|
|
|