My two cents
user1234
user1234 at 12.nl
Sat Oct 21 22:04:53 UTC 2017
On Saturday, 21 October 2017 at 21:45:11 UTC, Adam D. Ruppe wrote:
> On Saturday, 21 October 2017 at 20:02:28 UTC, user1234 wrote:
>> I'm not sure that people talked much about the elvis operator
>> (which was introduced in the topic by M.Nowak). In the first
>> message were mentioned the null coalescence operator "??"
>
> What's the difference between `?:` and `??`?
>
> As far as I can tell, they'd do the same thing in most cases.
Elvis operator returns LHS if LHS is true, otherwise RHS
Null coalescing operator returns LHS if LHS is not null,
otherwise RHS
But since in D nullable values can be interpreted as booleans
you're right "?:" would do the same as "??" and even more.
Actually "?:" is preferable (which i didn't realize in first
place :/).
More information about the Digitalmars-d
mailing list