Victor wrote:
In ASP,
I assume you mean "vbscript", not "ASP"
if I define a subroutine as private
Private Sub mySubroutine(arg1, arg2)
I understand that the variables I define inside the subroutine are
local only to the subroutine. If the same variable is defined outside
the subroutine, it won't conflict (right?)
Test it:
>
What about variables that are defined outside the subroutine, but not
inside? Are they available inside the subroutine?
Yes, variables assigned outside subroutines are global.
Here's a simple test:
<%
Dim x
x=1
response.write "outside - before call to foo: " & x & "<BR>"
foo
response.write "outside - after call to foo: " & x & "<BR>"
foo2
response.write "outside - after call to foo2: " & x & "<BR>"
sub foo()
dim x
x="inside foo"
response.write x & "<BR>"
end sub
sub foo2()
Response.Write "inside foo2 - initial value of x: " & x & "<BR>"
x=x+1
Response.Write "inside foo2 - final value of x: " & x & "<BR>"
end sub
%>
Do you have the vbscript documentation? If not, you can get it here:
http://tinyurl.com/7rk6
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"