What is VBScript data type?
VBScript has only one data type, called Variant. Variant is a special data type that can contain different categories of information depending on how it is used. Because Variant is the only data type in VBScript, it is also the data type for the return value of all functions in VBScript.
The simplest Variant can contain numeric or string information. Variant is used as a numeric process when used in a numeric context and as a numeric process when used in a string context. That is, if you use data that looks like a number, VBScript assumes it is a number and processed in a way that applies to the number. Similarly, if the data used is only possible strings, VBScript will be processed by string. Of course, you can also include numbers in quotes (" ") to make them a string.
Variant Subtype
In addition to simple numbers or strings, Variant can further distinguish the specific meaning of numerical information. For example, use numerical information to represent date or time. When used with other date or time data, the results are always expressed as date or time. Of course, numerical information is diverse from Boolean values to floating-point numbers. The numerical information type contained in Variant is called a subtype. In most cases, you can put the required data into a Variant, and Variant also operates in the way it applies best to the data it contains.
The following table shows the data subtypes that Variant contains:
Subtype
Empty
Uninitialized Variant. For numeric variables, the value is 0; for string variables, the value is a zero-length string ("").
Null
Variant that does not contain any valid data.
Boolean
Includes True or False.
Byte
Contains integers between 0 and 255.
Integer
Contains integers between -32,768 and 32,767.
Currency
-922,337,203,685,477.5808 to 922,337,203,685,477.5807.
Long
Contains integers between -2,147,483,648 and 2,147,483,647.
Single
Contains single-precision floating point numbers, with negative numbers ranging from -3.402823E38 to -1.401298E-45 and positive numbers ranging from 1.401298E-45 to 3.402823E38.
Double
Contains double-precision floating-point numbers, with negative numbers ranging from -1.79769313486232E308 to -4.94065645841247E-324, and positive numbers ranging from 4.94065645841247E-324 to 1.79769313486232E308.
Date (Time)
Contains numbers representing dates, ranging from January 1, 100 AD to December 31, 9999 AD.
String
Contains variable-length strings, with a maximum length of 2 billion characters.
Object
Contains objects.
Error
Includes error number.
You can use the conversion function to convert subtypes of data. In addition, the VarType function can be used to return the Variant subtype of the data.
VBScript has only one data type, called Variant. Variant is a special data type that can contain different categories of information depending on how it is used. Because Variant is the only data type in VBScript, it is also the data type for the return value of all functions in VBScript.
The simplest Variant can contain numeric or string information. Variant is used as a numeric process when used in a numeric context and as a numeric process when used in a string context. That is, if you use data that looks like a number, VBScript assumes it is a number and processed in a way that applies to the number. Similarly, if the data used is only possible strings, VBScript will be processed by string. Of course, you can also include numbers in quotes (" ") to make them a string.
Variant Subtype
In addition to simple numbers or strings, Variant can further distinguish the specific meaning of numerical information. For example, use numerical information to represent date or time. When used with other date or time data, the results are always expressed as date or time. Of course, numerical information is diverse from Boolean values to floating-point numbers. The numerical information type contained in Variant is called a subtype. In most cases, you can put the required data into a Variant, and Variant also operates in the way it applies best to the data it contains.
The following table shows the data subtypes that Variant contains:
Subtype
Empty
Uninitialized Variant. For numeric variables, the value is 0; for string variables, the value is a zero-length string ("").
Null
Variant that does not contain any valid data.
Boolean
Includes True or False.
Byte
Contains integers between 0 and 255.
Integer
Contains integers between -32,768 and 32,767.
Currency
-922,337,203,685,477.5808 to 922,337,203,685,477.5807.
Long
Contains integers between -2,147,483,648 and 2,147,483,647.
Single
Contains single-precision floating point numbers, with negative numbers ranging from -3.402823E38 to -1.401298E-45 and positive numbers ranging from 1.401298E-45 to 3.402823E38.
Double
Contains double-precision floating-point numbers, with negative numbers ranging from -1.79769313486232E308 to -4.94065645841247E-324, and positive numbers ranging from 4.94065645841247E-324 to 1.79769313486232E308.
Date (Time)
Contains numbers representing dates, ranging from January 1, 100 AD to December 31, 9999 AD.
String
Contains variable-length strings, with a maximum length of 2 billion characters.
Object
Contains objects.
Error
Includes error number.
You can use the conversion function to convert subtypes of data. In addition, the VarType function can be used to return the Variant subtype of the data.