3 ms·
Ruby got the safe navigation operator (&. to safely call methods on a nil-able value) in 2015, with Ruby 2.3, and credits "C#, Groovy and Swift" for inspiration
by square_usual 5y ago
Ruby got the safe navigation operator (&. to safely call methods on a nil-able value) in 2015, with Ruby 2.3, and credits "C#, Groovy and Swift" for inspiration there. So while it isn't exactly "?" (I think Groovy does use the ?), the semantics are close enough IMO.
Ref: https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released/ https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-rele...
- michaelcampbell 5y agoYes, Groovy has used '?' in various forms for some years now as well: https://www.logicbig.com/tutorials/misc/groovy/safe-navigation-operator.html https://www.logicbig.com/tutorials/misc/groovy/safe-navigati... https://www.logicbig.com/tutorials/misc/groovy/elvis-operator.html https://www.logicbig.com/tutorials/misc/groovy/elvis-operato...