This section describes rules on how arguments can be passed from the calling code into the called procedure by reference (the default) or by value.
As shown in previous examples, passing arguments to procedures seems to be a simple job.
But it may cause confusion if you don't following the rules. VBScript has the following rules on
passing arguments to function and subroutine procedures:
1. By default, arguments are passed by reference. In this case, an argument name can be used
as a variable that referring (sharing) the same data as the calling code.
2. But, arguments can be passed by value, if you put the key word "ByVal" before the argument name.
In this case, an argument name can be used as a variable that contains a copy of the data provided
by the calling code.
3. Of course, you put the word "ByRef" before an argument name to declare a pass-by-reference
argument explicitly.
4. A pass-by-reference argument can be used to allow the procedure to alter data that is
associated with a variable in the calling code. This allows the procedure to output data
back to the calling code.
5. A pass-by-value argument is safer than a pass-by-reference argument,
because the procedure only gets a copy of the data. Any changes to that data will not affect
the original data in the calling code.
6. Arrays can be passed by reference.
7. Arrays can also be passed by value. In this case, the procedure will get a copy of the array.
8. I don't know how to specify an array as the return value of a function procedure.