ByVal
the parameter is passed by value, thus the subroutine works with a copy of the original ByRef
the parameter is passed by reference, thus the subroutine works directly with the original
Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
So, if the subroutine is working continuously (somehow) it would always have the most up to date version of the variable?
But if that's right, what I don't understand (as a noobie) is how a subroutine would behave in this way. Surely the script would only continue after the subroutine has finished in which case the variable wouldn't have had the chance to change value...?
you pass something to sub routine, in regards to script execution the sub routine is synchronuous/blocking method call type of thing, i.e. nothing will continue until sub has finished.
one way to look at it
+ if you want the sub routine to modify the thing you have passed to it then use RyRef.
+ if you dont want the sub routine to modify the thing you have passed it then use ByVal
there are performance implications with passing byVal and byRef and these differ based on the type of variable you are passing, some might say the difference between the type is arbitary in vbscript but i would guess that ByRef is faster as you arent allocating more momery?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.