Modify ↓
Opened 13 years ago
Closed 13 years ago
#2434 closed Bug (No Bug)
Different behaviour between "=" and "=="
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.8.1 | Severity: | None |
| Keywords: | Cc: |
Description
It's different result when use "=" or "==" to compare string value with an integer number of 0:
Local $sTest = "test"
ConsoleWrite($sTest == 0) ; True
ConsoleWrite($sTest = 0) ;False
Attachments (0)
Change History (3)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
There is no bug.
Using the == operator converts both sides to strings and "test" is obviously not the same as "0".
However, the = operator does not do this - both sides are treated as numbers and Number("test") = 0. So 0 = 0 is true.
M23
comment:3 by , 13 years ago
| Resolution: | → No Bug |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.

Replying to anonymous:
Sorry, I made a mistake: