Loop/Array Problem

1. Junior Member
Join Date
Dec 1969
Posts
16

## Loop/Array Problem

This is the problem I am having.<BR><BR>I am using this script:<BR>&#060;%<BR>dim arr<BR>arr = Array("Scott", "Steve", "Carson", "Scott", "Mark", "Julie", "Scott")<BR>y = 0<BR>z = UBound(arr)<BR>Do While Not y=z + 1<BR>if arr(0) = arr(y) THEN Arr(y)="" End IF<BR>y = y + 1<BR>Loop<BR>Response.Write join(arr, ", ")<BR>%&#062;<BR>To try to remove all the Scotts from the array, but it only removes the first Scott in the Array.<BR><BR>Any Help would be much appreciated<BR>Thanks

2. Steve Cimino Guest

## RE: Loop/Array Problem

Of course it only removes the first Scott in the array... you set the element to "" at that point, and Scott &#060;&#062; "" later on.<BR><BR>You want to move the variable out of the loop:<BR><BR>sName = "Scott"<BR> For i = 0 to UBound(arr)<BR> If arr(i) = sName Then<BR> arr(i) = ""<BR> End If<BR> Next

3. Junior Member
Join Date
Dec 1969
Posts
16

## RE: Loop/Array Problem

NeverMind

4. Junior Member
Join Date
Dec 1969
Posts
16

## RE: Loop/Array Problem

Thank You, that is a good idea, and it works

#### Posting Permissions

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