Hi thorwath,
a short answer:
(1) sRet = x( sVar )
calls function x() AS a Function and passes sVarby reference (as it was intented by
the author); the () are for used to delimit the (short) parameter list - and to indicate
(redundantly) that this is a function call
(2) x sVar
calls function x() AS a Sub (of course, on wonders why); sVar will be modified by x();
no () hints at the fact, that this a Sub call
(3) x( sVar ) - better written as
x (sVar)
calls the function AS a Sub, but passing sVar by Value - indicated by the
() around the variable name; the () may be looking like parameter list
parantheses, but they aren't
(4) Call x( sVar )
calls x() As a Sub; because Call *needs* the parantheses (to indicate
that a function is called AS a Sub), the () aren't interpreted as
'please pass per Value' parantheses
(5) Call x( (sVar) )
will be behave as (3).
a longer discussion:
http://www.visualbasicscript.com/m_40908/tm.htm I agree with ebgreen's conclusion:
There is really just two things to remember if you avoid Call:
1) If the procedure returns a value, put () around the parameters.
2) If the procedure does not return a value, don't put () around parameters.
This will guide you right for 99% of your VBScript programming without
following my meanderings or learning by heart the rules TNO cited, especially
if you
don't call Functions As Subs, but use each of these different types
of NamedCodeBlocks/procedures as theirs authors intended them to be used (or
wrap bad designed ones in better Functions OR Subs of your own).