Difference between == and EQU operator?
Solution 1:
If EQU
finds that the two things being compared are valid integers (in octal, decimal, or hexadecimal), then an integer comparison will be performed.
For example, if 0x64 EQU 100 (echo yes) else (echo no)
returns yes
because 64 in hexadecimal is equivalent to 100 in decimal.
If either of the two things being compared cannot possibly be a valid integer (the number 09
, for example, which would be octal except that 9
isn't a valid octal digit), then a string comparison is performed.
==
only runs a string comparison, so if 0x64==100 (echo yes) else (echo no)
returns no
because the two strings are different.
In terms of simple string comparisons, the two operators act in essentially the same way, but EQU
takes a few clock cycles longer because it first has to try to convert the two items to integers.