nyonomay
-
Total Posts
:
1
- Scores: 0
-
Reward points
:
0
- Joined: 3/6/2008
-
Status: offline
|
Array Looping Problem
Thursday, March 06, 2008 1:39 PM
( permalink)
I am looping while both arrays are les than or equal to their ubound limits. I want to do a strComp and increment the i or j counters as below, depending on the outcome of the string. The problem is, when I run the program and feed it two arrays, the page either hangs and does nothing or I get an out of bounds error on i or j. I need this function to work when the arrays that are being passed to it are of different lengths. ANY help woul dbe wonderful, thanks in advance :) ----code--- function localTextMetric(tsortedTargetArray, sortedQueryArray) do while i <= ubound(sortedTargetArray) or j <= ubound(sortedQueryArray) if i<= ubound(sortedTargetArray) or j<= ubound(sortedQueryArray)then alpha = StrComp(sortedTargetArray(i), sortedQueryArray(j)) if alpha = -1 then i = i + 1 elseif alpha = 1 then j = j + 1 elseif alpha = 0 then i = i + 1 j = j + 1 intersection = intersection + 1 end if end if loop response.write(i) response.write(j) response.write(intersection) end function
|
|
|
|
webber123456
-
Total Posts
:
58
- Scores: 0
-
Reward points
:
0
- Joined: 9/20/2007
-
Status: offline
|
RE: Array Looping Problem
Friday, March 07, 2008 5:39 AM
( permalink)
get the lower value first then set the loop to use that number. don't try to do concurrently
|
|
|
|