title: VBScript implicit conversion in IF statement different from variable to literals?
body: <p>We are currently having an issue due to implicit conversion in an IF statement in VBScript (Classic ASP) that don't do implicit conversion the same way when dealing with a variable or a literal. Can someone explain this behavior to me, why do VBScript acts this way ?</p>
  
  <p>Here is a sample of what I mean :</p>
  
  <pre><code>Const c_test = 3
  Dim iId : iId = 3
  Dim iTestStr : iTestStr = "3"
  
  If iId = iTestStr Then
      Response.Write("Long variable = String variable : Equal")
  Else
      Response.Write("Long variable = String variable : Not Equal")
  End If
  
  Response.Write("&lt;br/&gt;")
  
  If c_test = iTestStr Then
      Response.Write("Long constant = String variable : Equal")
  Else
      Response.Write("Long constant = String variable : Not Equal")
  End If
  
  Response.Write("&lt;br/&gt;")
  
  If c_test = iId Then
      Response.Write("Long constant = Long variable : Equal")
  Else
      Response.Write("Long constant = Long variable : Not Equal")
  End If
  
  Response.Write("&lt;br/&gt;")
  
  If iId = "3" Then
      Response.Write("Long variable = String literal : Equal")
  Else
      Response.Write("Long variable = String literal : Not Equal")
  End If
  
  Response.Write("&lt;br/&gt;")
  
  If c_test = "3" Then
      Response.Write("Long constant = String literal : Equal")
  Else
      Response.Write("Long constant = String literal : Not Equal")
  End If
  </code></pre>
  
  <p>Which ouputs :</p>
  
  <p>Long variable = String variable : Not Equal</p>
  
  <p>Long constant = String variable : Not Equal</p>
  
  <p>Long constant = Long variable : Equal</p>
  
  <p>Long variable = String literal : Equal</p>
  
  <p>Long constant = String literal : Equal</p>
  
  <p>Which is quite confusing o_O</p>