title: Assign variables from array in for loop VBScript/Classic ASP
body: <p>I have a for loop which iterates through an array generated from a CSV file.  This creates an array with either 1, 2 or 3 sets of numbers.  Problem is, I need to assign these a variable as I need to use them later on in a web form.  Also; sometimes there may be only 1 set of numbers in the array (so only array(1) would be possible).  How would I assign the dynamic array to individual variables - ie - YXVal, RXVal and GXVal  for X and YYVal, RYVAL and GYVal for Y - but if there is only 1 in the array it would be YXVal and YYVal.</p>
  
  <pre><code>Do while NOT objTextFile.AtEndOfStream
      arrStr = split(objTextFile.ReadLine,",")
      for x = 1 to ubound(arrStr) 
          if arrStr(0) = "x" Then         
              Xval = arrStr(x)            
              response.write(XVal &amp; "&lt;br /&gt;")
          end if
      next    
      for y = 1 to ubound(arrStr)
          if arrStr(0) = "y" Then
              Yval = arrStr(y)            
              response.write(YVal &amp; "&lt;br /&gt;")
          end if
      next                
  Loop
  </code></pre>