Skip to main content

Get-Type-of-Variable

Command Description

Determine the type of a variable and return a string value based on the type, including: int, float, decimal, string, bool, null, array, dictionary, function, object and unknown

Command Prototype

sRet = Type(varData)

Parameter Description

ParameterRequiredTypeDefaultDescription
varDataTrueexpression$PrevResultThe data to be determined

return

sRet,The variable used to save the output of the command.

Demo

TracePrint("---------------------------------Get-Type-of-Variable------------------------------------") 
//-------------------------------------------------------------------------------
//[Remarks] Get the type of the variable, and return string, int, float, bool... etc. according to different types.
//Input parameter 1:
// varData----->Want to get the data of the variable type
//out parameters:
// Variable type
a = [1,2,3]
bRet = Type(a)
TracePrint("The variable type of [1,2,3] is: "&bRet)
a = "Hello UiBot"
bRet = Type(a)
TracePrint("Hello UiBot's variable type is: "&bRet)