PDA

View Full Version : Odd evaluation problem


deekay3k
11-01-2005, 03:48 PM
Simple one, I'm comparing two Arrays; why does this work:
array1[0]==array2[0] && array1[1]==array2[1] && array1[2]==array2[2]and this won't?array1==array2They have both been sorted prior to testing equality. Seems like I'm doing something wrong.

silverfish
11-01-2005, 03:59 PM
array1 and array2 both contain the same elements, but they are still two distinct Array objects

deekay3k
11-01-2005, 04:18 PM
Yeah, that makes sense. Which begs the question, why isn't there an Array comparison operator built into AS? Luckily I'm only comparing three values, many more and I need to create a for loop or a function to evaluate. Am I missing something?

silverfish
11-01-2005, 04:26 PM
other than "because they didn't provide one", I don't know why there isn't such an Array method. If you really, really don't want to code the comparison loop you could use the method which merges all Array elements into a String (sorry I forget its name) then compare the two strings. But you risk some false positives.