4 ms·
That's right, of course. I was just trying to convey the idea. But details matter of course. I was thinking of variables that either contained nil or contained
by omaranto 7y ago
That's right, of course. I was just trying to convey the idea. But details matter of course. I was thinking of variables that either contained nil or contained an object with the appropriate field. If that precondition isn't meant you need more robust code like yours.
But also, as another commenter pointed out, there is a distinction between "optional chaining" and "nil coalescing" and I explained (roughly) what optional chaining is.