Siebel VB Language Reference > Language Overview > Conventions >

Arguments


Arguments to subprograms and functions you write are listed after the subroutine or function and might or might not be enclosed in parentheses. Whether you use parentheses depends on whether you want to pass the argument to the subroutine or function by value or by reference.

If you pass an argument by value, the variable used for that argument retains its value when the subroutine or function returns to the caller. If you pass an argument by reference, the variable's value may be changed for the calling procedure. For example, suppose you set the value of a variable, x, to 5 and pass x as an argument to a subroutine, named mysub. If you pass x by value to mysub, then x remains 5 after mysub returns. If you pass x by reference to mysub, however, then x can be changed by mysub and may have a different value.

NOTE:  Siebel VB functions support a maximum of 32 arguments. If you need to use more than 32 arguments, use the Type function to define a custom data type and pass arguments of this new type.

To pass an argument by value, use one of the following syntax options:

Call mysub((x))

mysub(x)

y = myfunction((x))

Call myfunction((x))

To pass an argument by reference, use one of the following options:

Call mysub(x)

mysub x

y = myfunction(x)

Call myfunction(x)

Externally declared subprograms and functions (such as DLL functions) can be declared to take byVal arguments in their declaration. In that case, those arguments are always passed byVal.

NOTE:  Array variables cannot be passed to externally declared subprograms and functions.


 Siebel VB Language Reference
 Published: 18 June 2003