VBScript TypeName Function

Definition and Usage

The TypeName function can specify the sub-type of the variable.

Values that the TypeName function can return:

Value Description
Byte Byte value
Integer Integer value
Long Long integer value
Single Single precision floating point value
Double Double precision floating point value
Currency Currency value
Decimal Decimal value
Date Date or time value
String String value
Boolean Boolean value; True or False
Empty Not initialized
Null No valid data
<object type> Actual object type name
Object General object
Unknown Unknown object type
Nothing Object variable that has not been instantiated
Error Error

Syntax

TypeName(varname)
Parameter Description
varname Required. The name of the variable.

Example

dim x
x="Hello World!"
document.write(TypeName(x))
x=4
document.write(TypeName(x))
x=4.675
document.write(TypeName(x))
x=Null
document.write(TypeName(x))
x=Empty
document.write(TypeName(x))
x=True
document.write(TypeName(x))

Output:

String
Integer
Double
Null
Empty
Boolean