“Not Equal” Comparison Operators Used in Different Programs and Languages
ASCII not equal comparison operators range from ~=, !=, /=, =/=, to <>. Here is a table of the various operators and their corresponding programs or languages.
| Not Equal Comparison Operator | Program or Programming Language |
| ~= | MATLAB |
| != | MySQL, C, C++, PHP, Perl, Java, Javascript, Python |
| =/= | Erlang |
| !== | in PHP it checks the type as well as the value |
| <> | SQL, MySQL, ASP, Microsoft Excel, Visual Basic, and Visual Basic.Net |
| -ne | Bash |
Nice overview.
BTW I think I’ve seen === and !== in JavaScript as well as in PHP. Can you pls explain what its meaning is there? Because JavaScript does contain == and != as well. Does it have to do with the type comparison too?
Ruobo,
In Javascript, the Identity operator ‘===’ checks the type as well as if the values are exactly equal to each other. The equality operator ‘==’ does type coercion: converting numbers to strings and booleans to numbers and so on if the two objects are not of the same type.
The following are all True:
false == “”
false == 0
true == 1
“6″ == 6
var undef; undef == null;
But these are all False:
false === “”
false === 0
true === 1
“6″ === 6
var undef; undef === null;
So, a === b is basically equivalent to
(typeof a == typeof b && a == b);
a !== b is just the opposite of a===b :
!(a===b);
Usually it is a good idea to use === and !== in your javascript instead of == and != to avoid some hard to find bugs.
Some basic tips about javascript:
http://www.w3schools.com/js/js_comparisons.asp
More about the ‘===’ operator:
http://stackoverflow.com/questions/1029781/what-is-exactly-meaning-of-in-javascript
->> Josh W <<-