title: Classic ASP - Returning a value from a function
body: <p>I have a function in Classic ASP which receives a value and in the function it runs through various CASE statements. What I want to do is return the value of that function into a variable that I can use.</p>
  
  <p>For example</p>
  
  <pre><code>Function whichNumber(intNumber)
      SELECT CASE intNumber
          CASE 1
              whichNumber = "Yes"
          CASE 2
              whichNumber = "No"
      END SELECT 
  END Function
  </code></pre>
  
  <p>When I call that function in the webpage via: </p>
  
  <pre><code>whichNumber(intNumberToFunction)
  </code></pre>
  
  <p>I am expecting then the variable "whichNumber" to be either "Yes" or "No". So the next line in the code I use:</p>
  
  <pre><code>strNumberText = whichNumber
  </code></pre>
  
  <p>However that results in the error:</p>
  
  <p><strong>Wrong number of arguments or invalid property assignment: 'whichNumber'</strong> </p>
  
  <p>If I go back and in the function put the following at the end of the function:</p>
  
  <pre><code>Response.Write whichNumber
  </code></pre>
  
  <p>It correctly writes either "Yes" or "No" to the screen. Is there anyway to return the value of the function to a variable to use outside of the function?</p>
  
  <p>Hopefully this makes sense! Reading around the web it seems it might not be possible to return a value from a function like this?</p>