Link to home
Start Free TrialLog in
Avatar of LeeGolding
LeeGolding

asked on

ASP VBScript Subroutine Multiple Return Values

Hi friends,

Can subroutines return multiple values? If so how?

And will these return values have to be returned as an array? And again, how?

Thanks :-)

Lee.
ASKER CERTIFIED SOLUTION
Avatar of huji
huji
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LeeGolding
LeeGolding

ASKER

Hi again :-)

What about from a Sub?

Lee.
Well, SUBs are not created to return values. The can modifed the variables defined outside them (let's call them global variables) but they can not return values directly. Functions are used for that.
You may declare a variable outside your SUB, of array type and enough size. Then you may fill it inside your SUB.
Like this for example:

<%
  Option Explicit
  Dim Y(2)

  SetLocalVariable

  Response.Write Y(1)

Sub SetLocalVariable
    Y(1) = "Some text"
End Sub
%>
Thanks for clearing that up :-)

Lee.
You are very welcome. :)