Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't the C# inequality operator !==? [closed]

Tags:

operators

c#

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.

like image 690
finoutlook Avatar asked Dec 13 '22 10:12

finoutlook


1 Answers

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

like image 195
JaredPar Avatar answered Dec 27 '22 11:12

JaredPar