good
good copied to clipboard
?. operator
As @onokonem proposed, we can add ?. operator for structures, that basically struct field or nil operator.
reason is:
if structA.FieldA != nil {
someVar = structA.FieldA.FieldB
}
vs
someVar = structA.FieldA?.FieldB
I was wrong in the private discussion we had: not !. but ?.
http://groovy-lang.org/operators.html#_safe_navigation_operator
thanks @onokonem. fixed.