Modify ↓
Opened 17 years ago
Closed 17 years ago
#691 closed Bug (No Bug)
Not equal <> condition with OR gives wrong result
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.2.12.1 | Severity: | None |
| Keywords: | Cc: |
Description
Not equal <> condition with OR gives wrong result.
Example 1 give wrong result while example 2 gives correct result.
;example 1 (not working properly)
$temp=7
If $temp <> 1 OR $temp <> 7 Then
MsgBox(0, "MTM", "weekday")
Else
MsgBox(0, "MTM", "weekend")
EndIf
;example 2 (working properly)
$temp=7
If $temp = 1 OR $temp = 7 Then
MsgBox(0, "MTM", "weekend")
Else
MsgBox(0, "MTM", "weekday")
EndIf
Attachments (0)
Note:
See TracTickets
for help on using tickets.

I suggest you look again. If $temp is equal to 7 then $temp is not equal to 1 thus the first condition in your first example is true therefore the entire statement is true. You need to be using the AND operator in the first example, not OR.
No bug.