ASP Function Return Values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ziycon
    Contributor
    • Sep 2008
    • 384

    ASP Function Return Values

    I'm getting to grips with ASP Classic using VBScript. I'm having a problem with returning values from a function.

    No matter what I do I can't return values from another function to store in a variable. Any help much appreciated!

    Say I have:
    Code:
    Public Sub MainFunc()
      result = test "param1","param2"
    End Sub
    
    Private Sub test(param1In,param2In)
      {return value}
    End Sub
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    You say, "No matter what I do...", but I suspect you didn't try looking up vbscript syntax :) .
    Code:
    <%
    function helloWorld()
       helloWorld= "Hello dave"
    end function
    
    function helloYourName(name)
       helloYourName= "Hello " & name
    end function
    
    dim str
    
    str = helloWorld
    
    response.write "<p>" & str & vbNewLine
    
    str = helloYourName("Bob")
    
    response.write "<p>" & str & vbNewLine
    
     %>
    Output:
    Code:
    <p>Hello dave
    <p>Hello Bob
    Let me know if this helps.

    Jared

    Comment

    Working...