VBScript has only one data type called variant. Variant is a special data type. It can contain different types of information according to the method used. Because variant is the only data type in VBScript, it is also the data type returned by all functions in VBScript.
The simplest variant can contain numbers or strings. Variant is used as a number in the numeric context and as a string in the string context. That is to say, if you use data that looks like a number, VBScript assumes it is a number and processes it in a numeric way. Similarly, if the data used can only be a string, VBScript will process it by string. You can also enclose a number in quotation marks ("") to make it a string.
Variant
Child type
In addition to a simple number or string, variant can further differentiate the specific meaning of the value information. For example, a value is used to indicate a date or time. When such data is used together with other date or time data, the result is always expressed as a date or time. From a Boolean value to a floating point number, the value information is diverse. The numeric information type contained in variant is called a subtype. In most cases, you can put the required data into variant, and variant will perform operations in the way that best applies to the data it contains.
Variant
Data subtype included
| Empty |
Uninitialized VARIANT. For numeric variables, the value is 0; for string variables, the value is a string of zero length ("") |
| Null |
Variant that does not contain any valid data |
| Boolean |
Contains true or false |
| Byte |
Contains an integer between 0 and 255. |
| Integer |
Contains an integer between-32,768 and 32,767. |
| Currency |
-922,337,203,685,477.5808 to 922,337,203,685,477.5807 |
| Long |
Contains an integer between-2,147,483,648 and 2,147,483,647. |
| Single |
Contains a single-precision floating point number. The negative value ranges from-3.402823e38 to-1.401298e-45, and the positive value ranges from 1.401298e-45 to 3.402823e38. |
| Double |
Contains a double-precision floating point number. The negative value ranges from-1.79769313486232e308 to-4.94065645841247e-324. The positive value ranges from 4.94065645841247e-324 to 1.79769313486232e |
| Date (time) |
Contains the number indicating the date. The date range is from January 1, January 1, 100 AD to January 1, December 31, 9999 AD. |
| String |
Contains a variable-length string, up to 2 billion characters |
| Object |
Contains objects |
| Error |
Contains error code |