Comparing Arrays

1. AJ
Senior Member
Join Date
Dec 1969
Posts
405

## Comparing Arrays

I am attempting to compare 2-2 dimential arrays but only the first location.<BR><BR>The arrays can contain the same information but in different locations in the arrays.<BR><BR>Here is the code I am trying to use. When I choose the first person all of the information lines up except for the last one that is because the first person has all the classes but the last one in his array. The second person only has classes 1 and 3 so after the first location the rest are invalid even though he has 2 valid classes but they are in different locations in the array.<BR><BR>I am sure it is something simple that I am missing. Thanks for your help in advance.<BR><BR><BR><BR>y = 0<BR>t = 1<BR><BR>do while ahclass(1,t) &#060;&#062; acclass(1,y)<BR> for y = 1 to i<BR> if ahclass(1,t) = acclass(1,y) Then<BR> Response.Write "Class&#039;s are the same"<BR> Elseif ahclass(1,t) &#060;&#062; acclass(1,y) then<BR> Response.Write "Class&#039;s are NOT the same"<BR> End if<BR> t = t + 1<BR> next<BR>loop<BR>

2. wizard Guest

## RE: Comparing Arrays

try this:<BR>arr1, arr2 are, say,arrays.<BR>flgSame = true<BR>for i=1 to 2<BR> for j = 1 to 2<BR> if arr1(i,j) &#060;&#062; arr2(i,j) then<BR> flgSame = false;<BR> exit for<BR> end if<BR> next<BR> if not flgsame then<BR> exit for<BR> end if<BR>next<BR>if flgsame then<BR> "same"<BR>else<BR> "not same"<BR>end if<BR><BR>This works if u have two 2-d arrays and want to compare if they are exaclt the same.<BR><BR><BR><BR>

3. AJ
Senior Member
Join Date
Dec 1969
Posts
405

## RE: Comparing Arrays

What if you want to compare 2 arrays that are different?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•