Modify

Opened 18 months ago

Last modified 18 months ago

#3890 assigned Feature Request

Array Comparison

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 ====

Attachments (0)

Change History (3)

comment:1 Changed 18 months ago by Jpm

  • Owner set to Jpm
  • Status changed from new to assigned

Fix sent to Jon

comment:2 Changed 18 months ago by TicketCleanup

  • Version 3.3.14.0 deleted

Automatic ticket cleanup.

comment:3 Changed 18 months ago by mLipok

  • Description modified (diff)

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.

Add Comment

Modify Ticket

Action
as assigned The owner will remain Jpm.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.