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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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
%>
<%
Option Explicit
Dim Y(2)
SetLocalVariable
Response.Write Y(1)
Sub SetLocalVariable
Y(1) = "Some text"
End Sub
%>
ASKER
Thanks for clearing that up :-)
Lee.
Lee.
You are very welcome. :)
ASKER
What about from a Sub?
Lee.