Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Duplicate
-
None
-
None
-
None
Description
It would be nice to have an operator similar to the Elvis operator but for assignments.
a ?= b
as a shorthand for
a = b ?: a
I'm not a Ruby expert but from the Groovy mailing list it sounds like Ruby has an operator like this.
Attachments
Issue Links
- duplicates
-
GROOVY-3880 Optional Assignment Operator
- Closed
- is related to
-
GROOVY-5306 [PARROT] Add "a ?= 2" support (Elvis assignment): should be expanded to "a = a == null ? 2 : a"
- Closed
-
GROOVY-3880 Optional Assignment Operator
- Closed
-
GROOVY-5291 Add "a ?:= 2" support: should be expanded to "a = a ?: 2"
- Closed