?. isn't a no-op. It's an expression which returns null. Now, you've got a null expression sitting there which either needs to be discarded in the case of an intended no-op, or downstream needs to put the default value rather than the method internalizing the default value.
Is this syntactic sugar for things that can already be done? Yes. But then every language construct is syntactic sugar for things that can already be done.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
?.
isn't a no-op. It's an expression which returnsnull
. Now, you've got a null expression sitting there which either needs to be discarded in the case of an intended no-op, or downstream needs to put the default value rather than the method internalizing the default value.Is this syntactic sugar for things that can already be done? Yes. But then every language construct is syntactic sugar for things that can already be done.