Functions and Directives

Function Valtype() Foundation

Determines the data type of a value.

Valtype( <Expression> ) --> cType
<Expression> is an expression of any data type.

The return value of Valtype() is a single character indicating the data type of the value of <Expression>. The following table lists the possible data types and the return values of Valtype():

Data types and return values of Valtype()
Return value Data type
A array
B code block
C character string
D date value
L logical value
M memo field
N numeric value
O object


Valtype() is a debugging function which determines the data type of a variable or a function argument. Valtype() returns a single character which identifies the data type. The function determines the data type of a variable directly without using the macro operator (&). Valtype() differs in this way from the function Type() which uses the macro operator. Valtype() can determine the data type of variables which are declared as LOCAL or STATIC.

// The example shows the possible return values of Valtype() 

   ? Valtype( {1,2,3} )             // result: A 
   ? Valtype( {|| 1 } )             // result: B 
   ? Valtype("Xbase++")             // result: C 
   ? Valtype( Date() )              // result: D 
   ? Valtype(.T.)                   // result: L 
   ? Valtype( 1 )                   // result: N 
   ? Valtype( Customer->Notice)     // result: M 
   ? Valtype( Getnew() )            // result: O 
   ? Valtype( NIL )                 // result: U 

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.