Type()

Auto Hotkey

Type

Returns the exact type of a value.

OutputVar := Type(Value)

Return Value

The return value is a string indicating the type of Value. Possible values include:

  • String
  • Integer
  • Float
  • Object
  • RegExMatchObject
  • Func
  • FileObject
  • ComObject
  • Struct

If Value is an object, the return value may be "Object" or a more specific built-in type such as "Func", "FileObject" or "ComObject".

Remarks

This function typically shouldn't be used to determine if a value is numeric, since numeric strings are valid in math expressions and with most built-in functions. However, in some cases the exact type of a value is more important. For instance, if NumPut is passed a variable containing a pure integer (not a numeric string), the integer will be used instead of the address of the variable.

To check if a value can be used as a number, use the expression value is type, where type is "number", "integer" or "float".

To check for any type of object, use the expression value is 'object'.

To check if an object is derived from a particular user-defined class, use value is ClassName.

Related

Variable types, Expressions, Value is Type

Examples

a := 1, b := 2.0, c := "3"
MsgBox % Type(a)  ; Integer
MsgBox % Type(b)  ; Float
MsgBox % Type(c)  ; String