Variable type conversion

klaus

Expert
Licensed User
Longtime User
Will there be variable type conversion functions ?
Like
CInt to convert any type to an Integer
CDbl to convert any type to a Number (Double)
CStr to convert any type to a String

Or is the conversion done automatically by B4PPC ?

Best regards.
 

agraham

Expert
Licensed User
Longtime User
It is done automatically if you assign the contents of one typed variable to another differently typed variable. You will get an exception if the conversion can't be done.

Dim S
Dim I As Integer
Dim N As Number

N = 1.234 ' contents are a Double value 1.234
S = N ' contents are a string "1.234"
I = S ' contents are rounded/truncated to an Int32 value of 1
 
Top