title: Variable scope in VBScript functions
body: <p>I have a question about variable scope in VBScript.  I know there's the following keywords (from <a href="http://www.autoitscript.com/autoit3/docs/keywords/Dim.htm" rel="noreferrer">autoitscript.com</a>):</p>
  
  <ol>
  <li>Dim = Local scope if the variable name doesn't already exist globally (in which case it reuses the global variable!)</li>
  <li>Global = Forces creation of the variable in the Global scope</li>
  <li>Local = Forces creation of the variable in the Local/Function scope</li>
  </ol>
  
  <p>Imagine that I have the following .vbs file:</p>
  
  <pre><code>Dim strPath
  
  strPath = "C:\folder"
  
  DisplayPath strPath
  
  Sub DisplayPath(strPath) 'Does this strPath get it's own local scope?
    MsgBox strPath
  End Sub
  </code></pre>
  
  <p><strong>In the function: <code>DisplayPath(strPath)</code>, is <code>strPath</code> a <em>local</em> variable?  Or do functions/subs have access to the <code>strPath</code> defined at the top of the main section of the script as a <em>global</em> variable?</strong></p>
  
  <p>Also, what's the point of explicitly using <code>Dim</code> versus just defining variables as I use them, which is possible in scripting languages?</p>