good icon indicating copy to clipboard operation
good copied to clipboard

?. operator

Open kirillDanshin opened this issue 8 years ago • 2 comments

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

kirillDanshin avatar Jan 24 '17 11:01 kirillDanshin

I was wrong in the private discussion we had: not !. but ?.

http://groovy-lang.org/operators.html#_safe_navigation_operator

onokonem avatar Jan 24 '17 11:01 onokonem

thanks @onokonem. fixed.

kirillDanshin avatar Jan 24 '17 11:01 kirillDanshin