Opened 2 years ago
Last modified 8 months ago
#3890 assigned Feature Request
Array Comparison — at Version 3
Reported by: | Jpm | Owned by: | Jpm |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | Severity: | None | |
Keywords: | Cc: |
Description (last modified by mLipok)
I notice that "if $array = $array" return False
so using the following script
Local $array1 = [1,2,3,4] Local $array2 = [4,5,6] Local $array2_same = [4,5,6] Local $array2_copy = $array2 ConsoleWrite("comparison not sensitive (=)" & @CRLF) If $array1 = $array1 Then ConsoleWrite ('@@ Debug(' & @ScriptLineNumber & ") $array1 = $array1" & @CRLF) If NOT($array1 = $array2) Then ConsoleWrite ('@@ Debug(' & @ScriptLineNumber & ") $array1 != $array2 ==== current release 3.3.16.0 ====" & @CRLF) If NOT($array2 = $array2_same) Then ConsoleWrite ('@@ Debug(' & @ScriptLineNumber & ") $array2 != $array2_same ==== current release 3.3.16.0 ====" & @CRLF) If $array2 = $array2_copy Then ConsoleWrite ('@@ Debug(' & @ScriptLineNumber & ") $array2 = $array2_copy" & @CRLF) ; comparison sensitive so all different ConsoleWrite(@CRLF & "comparison sensitive (==) so all different" & @CRLF) If NOT($array1 == $array1) Then ConsoleWrite ('@@ Debug(' & @ScriptLineNumber & ") $array1 <> $array1" & @CRLF) If NOT($array1 == $array2) Then ConsoleWrite ('@@ Debug(' & @ScriptLineNumber & ") $array1 <> $array2" & @CRLF) If NOT($array2 == $array2_same) Then ConsoleWrite ('@@ Debug(' & @ScriptLineNumber & ") $array2 <> $array2_same" & @CRLF) If NOT($array2 == $array2_copy) Then ConsoleWrite ('@@ Debug(' & @ScriptLineNumber & ") $array2 <> $array2_copy" & @CRLF) ConsoleWrite(@CRLF & "modification of $array2_copy[2], so it will be different" & @CRLF) $array2_copy[2] = 7 ; modification so it will be different If Not ($array2 = $array2_copy) Then ConsoleWrite ('@@ Debug(' & @ScriptLineNumber & ") $array2 != $array2_copy ==== current release 3.3.16.0 ====" & @CRLF)
I get under current release 3.3.16.0
comparison not sensitive (=) @@ Debug(11) $array1 != $array2 ==== current release 3.3.16.0 ==== @@ Debug(12) $array2 != $array2_same ==== current release 3.3.16.0 ==== comparison sensitive (==) so all different modification of $array2_copy[2], so it will be different @@ Debug(24) $array2 != $array2_copy ==== current release 3.3.16.0 ====
so I propose to be more consistant when comparing array's
comparison not sensitive (=) @@ Debug(10) $array1 = $array1 @@ Debug(11) $array1 != $array2 ==== current release 3.3.16.0 ==== @@ Debug(12) $array2 != $array2_same ==== current release 3.3.16.0 ==== @@ Debug(13) $array2 = $array2_copy comparison sensitive (==) so all different @@ Debug(17) $array1 <> $array1 @@ Debug(18) $array1 <> $array2 @@ Debug(19) $array2 <> $array2_same @@ Debug(20) $array2 <> $array2_copy modification of $array2_copy[2], so it will be different @@ Debug(24) $array2 != $array2_copy ==== current release 3.3.16.0 ====
Change History (3)
comment:1 Changed 2 years ago by Jpm
- Owner set to Jpm
- Status changed from new to assigned
comment:3 Changed 2 years ago by mLipok
- Description modified (diff)
Note: See
TracTickets for help on using
tickets.
Fix sent to Jon