vbscript
How to run a command at the command line/execute a command:
Criticisms:
From: Al Dunbar (Al_Dunbar@HoTMaiL.com)
Subject: Re: How do you pass parameters by reference and by value in a VBScript sub/function?
Newsgroups: microsoft.public.scripting.vbscript
View this article only
Date: 2000-11-05 11:36:03 PST
By default, all parameters are passed by reference, unless either of the
following two conditions applies:a) the formal parameter in the sub/function statement is prefixed with the
"ByVal" qualifier:sub mysub( prm1, prm2, byref prm3, byref prm4, byval prm5, byval prm5 )
b) the actual parameter passed is something that cannot be assigned a value:
sub mysub( arg1, (arg2), arg3, (arg4), arg5, (arg6) )
In the example above, the following are effectively passed by reference:
arg1, arg3, while the rest are passed by value. Note that even when a formal
parameter is defined (or defaulted) to byref an actual parameter can be
passed by value (i.e. by passing an expression rather than a variable).
However, if the formal parameter is defined with byval, there is no way to
force the actual parameter to return a value.IMO, defining all parameters explicitly as either byref or byval is a good
way to avoid unintended side effects, while at the same time improving the
quality of the internal documentation of a procedure.
/Al