Function Valtype() Foundation

Determines the data type of a value.

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

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
U NIL

Description

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.

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

PROCEDURE Main 
   ? 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 
RETURN 
Feedback

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.