Cast and Convert

This program demonstrates the use of Cast and data type conversion functions.

'Cast and Conversion
'Demostrates using Cast and data type conversion functions.
'*********************************************************

dim as double myDouble1, myDouble2, myDouble3
dim as integer myInt

'Set variable ranges
myDouble1 = 143.5
myDouble3 = 143.4
myDouble2 = -143.5
myInt = 12

'Show cast in action
Print "** Cast **"
print "Double1 ";myDouble1;" cast to integer ";Cast(Integer, myDouble1)
print "Double2 ";myDouble2;" cast to integer ";Cast(Integer, myDouble2)
print "Double3 ";myDouble3;" cast to integer ";Cast(Integer, myDouble3)
print "Expression ";myDouble1;" + ";myInt;" cast to double ";Cast(Double, myDouble1 + myInt)
print

'Show cint in action
Print "** CInt **"
print "Double1 ";myDouble1;" cint to integer ";CInt(myDouble1)
print "Double2 ";myDouble2;" cint to integer ";CInt(myDouble2)
print "Double3 ";myDouble3;" cint to integer ";CInt(myDouble3)
print "Expression ";myDouble1;" + ";myInt;" cint to integer ";CInt(myDouble1 + myInt)
print "Expression ";myDouble2;" + ";myInt;" cint to integer ";CInt(myDouble2 + myInt)
print

sleep
end