TYPE function

TYPE(Value?) TYPE(Value?)

Value

Number, Logical, Text, Color or { ? } (optional)

The value whose type should be returned.

Returns

Number

1 if the value is a number, 2 if the value is a text string, 4 if the value is a logical value, 16 if the value is an error, 64 if the value is an array and 65536 (2^16) if the value is a color.

Returns the type of the given value. TYPE(42)TYPE(42) returns 1, indicating that 42 is a number.

These are the values returned by this function:

Values returned by TYPE
Type of value Return value
Number 1
Text 2
Logical (TRUE or FALSE) 4
Error 16
Array ({ ? }) 64
Color 65536 (2^16)

Calcapp has many additional types (representing things like number fields and reset buttons) that are not covered by this function.

Examples

TYPE(42)TYPE(42)

Returns 1, indicating that 42 is a number.

TYPE("42")TYPE("42")

Returns 2, indicating that "42" is a text string.

TYPE(TRUE)TYPE(TRUE)

Returns 4, indicating that TRUE is a logical value.

TYPE(Field1 / Field2)TYPE(Field1 / Field2)

Returns 16, provided that the value of Field2 is 0 or blank, which triggers a #DIV/0! error ("division by zero"). Otherwise, 1 is returned, indicating that the value is a number.

TYPE({ 1, 2, 3 })TYPE({ 1; 2; 3 })

Returns 64, indicating that the value is an array.

TYPE(Color.Red)TYPE(Color,Red)

Returns 65536, indicating that the value is a color.

TYPE(INDEX({ 1, 2, 3 }, 1))TYPE(INDEX({ 1; 2; 3 }; 1))

Returns 1, indicating that the first element of the array is a number.