kryton9
23-09-2007, 21:56
When calling a function having parameters of type VARIANT passes BYVAL, passed numeric values can be typed. An example can clarify.
If you have a function like:
Function MyFunction(ByVal v1 As Variant) As Long
'...
End Function
you can call it passing any value plus a type in case of numeric. For example, the following are all accepted ways:
MyFunction("Whatever string")
MyFunction(123)
MyFunction(123 As QUAD)
MyFunction(1234.678)
MyFunction(1234.678 As Single)
MyFunction(12345.67898889 As Double)
In this way,
This is really a neat feature. Can we do something similar in powerBasic? As far as I can tell we can only use variant with com objects?
If you have a function like:
Function MyFunction(ByVal v1 As Variant) As Long
'...
End Function
you can call it passing any value plus a type in case of numeric. For example, the following are all accepted ways:
MyFunction("Whatever string")
MyFunction(123)
MyFunction(123 As QUAD)
MyFunction(1234.678)
MyFunction(1234.678 As Single)
MyFunction(12345.67898889 As Double)
In this way,
This is really a neat feature. Can we do something similar in powerBasic? As far as I can tell we can only use variant with com objects?