Scripting > UNICOM Intelligence Function Library > Miscellaneous functions > VarType
 
VarType
Returns a numeric value indicating the type of a variable.
Syntax
VarType(Val)
Parameters
Val
Type: Long
The data value.
(return)
Type: Long
The type of Val.
Remarks
The return value is a number representing the type of Val, as shown below.
Value
Type of Val
0
None (Val is NULL)
1
Long
2
Text
3
Categorical
4
Object
5
Date
6
Double
7
Boolean
An error occurs if Val has any other type.
This function is similar to the VarType function in Visual Basic.
Example
The following mrScriptBasic example uses the VarType function to determine the type of a variable:
Dim MyVar, MyTest

MyVar = 34
MyTest = VarType(MyVar) ' Returns 1

MyVar = "Hullo"
MyTest = VarType(MyVar) ' Returns 2

MyVar = {1, 2, 3, 4}
MyTest = VarType(MyVar) ' Returns 3
See also
VarTypeName
Miscellaneous functions