#3774 closed Bug (Fixed)
Comparisons with Null wrong for <= and >=
Reported by: | AlanParry | Owned by: | Jpm |
---|---|---|---|
Milestone: | 3.3.15.4 | Component: | AutoIt |
Version: | 3.3.14.5 | Severity: | None |
Keywords: | Cc: |
Description
If one runs this
if Null = 3 Then ConsoleWrite("=" & @CRLF) if Null < 3 Then ConsoleWrite("<" & @CRLF) if Null > 3 Then ConsoleWrite(">" & @CRLF) if Null <= 3 Then ConsoleWrite("<=" & @CRLF) if Null >= 3 Then ConsoleWrite(">=" & @CRLF) if Null <> 3 Then ConsoleWrite("<>" & @CRLF) if Null == 3 Then ConsoleWrite("==" & @CRLF)
then <= and >= are True, which can't be what's expected. Why would <= be true when < and = are both false?
Has a <= b been implemented as Not(a > b) perhaps? That may be the problem.
(Also the result for <> is questionable as some other languages would give that as false, but I am happy with autoit's choice in that case, and changing <> is probably a script breaker)
Tested on 3.3.14.5 and 3.3.15.3
Alan
Attachments (0)
Change History (3)
comment:1 Changed 4 years ago by Jpm
comment:2 Changed 4 years ago by Jpm
- Milestone set to 3.3.15.4
- Owner set to Jpm
- Resolution set to Fixed
- Status changed from new to closed
Fixed by revision [12361] in version: 3.3.15.4
comment:3 Changed 4 years ago by AlanParry
Hi,
I don't think this is a docucmentation issue.
Why does either of
if Null <= 3 Then ConsoleWrite("<=" & @CRLF) if Null >= 3 Then ConsoleWrite("<=" & @CRLF)
do the ConsoleWrite - they shouldn't! These correctly don't:
if Null = 3 Then ConsoleWrite("=" & @CRLF) if Null < 3 Then ConsoleWrite("<" & @CRLF) if Null > 3 Then ConsoleWrite(">" & @CRLF)
Your examples use the = operator which does what I expect. The < and > operators also work fine, But the <= and >= operators I think are bugged.
Alan
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Hi,
In fact the doc is wrong
Null is a special keyword and the comparison is only true if the variable is affected to Null
see the following
I will fix the doc