typeOf

Syntax typeOf (value)

Params value is an object of any datatype whose type you wish to determine.

Action Determines the datatype of value.

Examples typeOf (2+2)

   » long

typeOf (examples.testText)

   » wptx // datatype for word processing text objects

typeOf (@examples.testText)

   » addr

The parameter provided is an address; therefore, it is not the type of the object at that location that is returned.

typeOf (examples[1])

   » long // First entry in table as sorted is "age," a long.

if typeOf (examples.list1) != outlinetype
{msg ("Who messed with this object?")}

Notes You can use typeOf to determine the datatype of a user entry or of a return value from another script so you can determine if it can and should be coerced, for example.

Although typeOf returns a four-character type identifier, you never need to use this information in your scripts. Frontier defines a constant for each of these types. They are stored in the Object Database at system.compiler.language.constants and are

also listed in Chapter 1 of the UserTalk Reference Guide. This also means that if you use typeOf in a script where you wish to check the type of an object, you should use the constant value, as in the fifth example, above.

See Also sizeOf

coerceValue

Discuss