title: Error 'variable is undefined' when calling a function
body: <p>I have created a classic asp page with a function like the following:</p>
  <pre><code>&lt;%@ Language=VBScript %&gt;
  &lt;% Option Explicit %&gt;
  
  &lt;%
        &lt;!--#INCLUDE file='ADOVBS.inc'--&gt;
         Response.Buffer = True
  
  %&gt;
  &lt;%
        Function Lettergrade(lg)
  
               Dim lgs
               if lg&gt;50 then
              set    lgs=&quot;P&quot;
                  else
              set    lgs=&quot;F&quot;
               end if
             set Lettergrade= lgs
         End Function
    %&gt;
  &lt;%
  set strlettergrade=Lettergade(strgrade)
  ... other code goes here
  %&gt;
  </code></pre>
  <p>I'm trying to call the function in an expression but when it gives me the following error:</p>
  <blockquote>
  <p>Microsoft VBScript runtime error '800a01f4'</p>
  <p>Variable is undefined: 'Lettergade'</p>
  </blockquote>
  <p>Does anyone have an idea?</p>