This syntax regarding null checking baffles me

Basile B. b2.temp at gmx.com
Thu Jan 7 05:14:44 UTC 2021


On Thursday, 7 January 2021 at 04:57:55 UTC, 12345swordy wrote:
> if (c !is null) Why?????
>
> Would it be simpler to type
>
> if (c is not null)
>
> on a related note. Why are not we allowed to do this?
>
> if (c != null)

it is allowed

>
> when other languages such as c#/java allow for it?
>
> -Alex

"is" checks the address whereas "==" and "!=" eventually takes 
the path of operator overloading, i.e opEquals.



More information about the Digitalmars-d mailing list