title: Searching array with an If Statement ASP
body: <p>I have this function searching if a value exist through an array. Here's my function:</p>
  
  <pre><code>Function in_array(iCountryID, iCountryArray)
  in_array = False
  For i=0 To Ubound(iCountryArray)
      If iCountryArray(i) = iCountryID Then
          in_array = True
          Exit Function      
       End If
   Next
   End Function
  
   ThisCountry = iCountryID
   CountryArray = Array(99,115,218,305)
   If in_array(ThisCountry, CountryArray) Then 
       Response.Write ThisCountry &amp; " is in the array"
   Else 
       Response.Write ThisCountry &amp; " is not in the array"
   End If
  </code></pre>
  
  <p>This works fine. My issue is that the values inside my array (99,115,218,305) are dynamic. I have a variable that creates that value through a query.</p>
  
  <p>iCountryArray is my variable that stores the values 99,115,218,305. So instead of manually entering those values to my array, I need to add them dymanically.</p>
  
  <p>This doesn't work:</p>
  
  <pre><code>CountryArray = Array(" &amp; iCountryArray &amp; ")
  </code></pre>