vbscript - In a set of loops, why is only the first one being considered? -
vbscript - In a set of loops, why is only the first one being considered? -
this code part of function thats beingness called several times.
for r = 0 4 until searchname.atendofstream linedata = lcase(searchname.readline()) if instr(linedata,n(r))>0 if (r = 0) v = v + 1 elseif (r = 1) w = w + 1 elseif (r = 2) x = x + 1 elseif (r = 3) y = y + 1 elseif (r = 4) z = z + 1 end if end if loop next
my problem considers r = 0
. i've tried ubound(n)
instead. i've tried replacing for (r = 0)
loop 5 separate loops v
, w
, x
, y
, z
. i've tried several other methods , different formatting too, still didn't work.
after r = 0
case, when inner loop has reached searchname.atendofstream
, increment next value or r
, searchname
still @ end of stream. therefore, do
loop runs first case of for
loop. consider alternative:
do until searchname.atendofstream linedata = lcase(searchname.readline()) r = 0 4 if instr(linedata,n(r))>0 if (r = 0) v = v + 1 elseif (r = 1) w = w + 1 elseif (r = 2) x = x + 1 elseif (r = 3) y = y + 1 elseif (r = 4) z = z + 1 end if end if next loop
by switching loops around, don't reach end of stream until you've finished iterating on both.
loops vbscript asp-classic filesystemobject
Comments
Post a Comment