The following table lists the compatible data types for variables used as parameters that are passed by Val or Var.
Parameter Type as Declared Inside the Procedure |
Compatible Val Argument Type |
Compatible Var Argument Type |
Any numeric type |
Any numeric data type, Variant |
Same numeric type |
String or BString |
String, BString, Variant |
Same String or BString |
Object |
Object, Variant |
Object |
Procedure |
Procedure |
Procedure |
Variant |
Any data type (that can be stored in Variant type) |
Any data type (that can be stored in Variant type) |
Any |
Any data type |
Any data type |
The following is an example of passing an argument to a Val parameter of a procedure. When an argument is passed to a Val parameter, the effect is identical to an assignment statement with the value parameter on the left side and the argument expression on the right side.
The argument expression is converted to the data type of the parameter as necessary.
For example, if ProcedureA expect its first parameter to be a Double variable:
ProcedureA(dDouble,...)
And if you call ProcedureA as follows:
ProcedureA(17,...)
Then the argument value of 17 will be converted to the Double ( 8-byte real ) value of 17.0 and assigned the parameter dDouble.
For more information on Val or Var parameters, see Procedure Parameters.