In C#, ==
is used to check equality, whereas =
is for assignment.
Does this mean that checking for inequality should really be !==
.
Why isn't this the case? Os it for historical reasons?
The rise of !=
has seen it establish itself in most SQL variations now too.
C# had a lot of influence from Java and C/C++ both of which use ==
and !=
. I imagine they simply chose to stick with the existing predominant pattern instead of reinventing the wheel. Choosing another syntax say ===
for equality and !===
for inequality would've been a stumbling block for the vast majority of developers they were targeting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With