
function argument list...
Quote:
> Hi,
> I was wondering if we can declare a function without specify the number of
> arguments its going to have and call that function with any number of
> arguments?
> Something similar in JScript is:
> function myFunc() {
> for (i=0; i < myFunc.arguments.length; i++)
> -----
> -----
> myFunc.arguments[i] ;
> -----
> -----
> }
> Thanks in advance.
> Saqib.
No, there is no (specific) provision for optional arguments in
VBScript. However, a common work around is to pass an array as the
single argument and code the function/subroutine to handle an array of
arbitrary length, something like this ...
result1 = Summation(Array(Var1, Var2, Var3))
result2 = Summation(Array(A, B, C, D, E))
Function Summation(aVector)
dim nTemp, I
for I in 0 to UBound(aVector)
nTemp = nTemp + aVector(I)
Next
Summation = nTemp
End Function
Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/