Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-09-2004, 06:42 PM   PM User | #1
codefox
Regular Coder

 
Join Date: Nov 2002
Location: India
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts
codefox is an unknown quantity at this point
Passing a parameter by reference

It's been a while since I worked with ASP, I've forgotten some concepts. I know vb (and hence vbscript) passes arguments by reference. The following page gave me 100, I expected 1000:

Code:
<%
Dim a

a = 10

call test1(a)

Response.Write a

Sub test1(b)
	b = 100
	test2(b)
End Sub

Sub test2(c)
	c = 1000
End Sub
%>
Why's that test2(b) did not change the value of b in test1? Is it because parameter variables are not passed by reference?

Thanks.
codefox is offline   Reply With Quote
Old 08-09-2004, 06:56 PM   PM User | #2
Grant Palin
Regular Coder

 
Join Date: Jun 2002
Location: Victoria, BC, Canada
Posts: 962
Thanks: 0
Thanked 1 Time in 1 Post
Grant Palin is an unknown quantity at this point
I think VB and VBScript actually pass by value...I may be wrong though.

However, just to be sure, try adding "ByRef" in front of the appropriate paraemter in your parameter lists.
Grant Palin is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:24 AM.


Advertisement
Log in to turn off these ads.