title: In a set of loops, why is only the first one being considered?
body: <p>This code is part of a function thats is being called several times.</p>
  
  <pre><code>for r = 0 to 4
      do until searchname.AtEndOfStream
          lineData = lcase(searchname.ReadLine())
          if instr(lineData,N(r))&gt;0 then
              if (r = 0) then
                  v = v + 1
              elseif (r = 1) then
                  w = w + 1
              elseif (r = 2) then
                  x = x + 1
              elseif (r = 3) then
                  y = y + 1
              elseif (r = 4) then
                  z = z + 1
              end if
          end if
      loop
  next
  </code></pre>
  
  <p>My problem is that it only considers <code>r = 0</code>. I've tried <code>ubound(N)</code> instead. I've also tried replacing the <code>for (r = 0)</code> loop with five separate loops for <code>v</code>, <code>w</code>, <code>x</code>, <code>y</code> and <code>z</code>. I've tried several other methods and different formatting too, but it still didn't work.</p>