How to Use the TYPE() Function

ID: Q88975

The information in this article applies to:

The TYPE() function returns the data type code for a specified expression. Quotation marks are required around the specified variable or field name used.

The following examples demonstrate the use of the TYPE() function:

Example 1

   x=1
   ? TYPE("x")   && returns N

Example 2

   x="TEST"
   ? TYPE("x")   && returns C

Example 3

   x=DATE()
   ? TYPE("x")   && returns D

Example 4

   x=1
   ? TYPE(x)     && returns an ERROR

Example 5

   x="TEST"
   ? TYPE(x)     && returns U

Example 4 returns an error because FoxPro tries to use x as a subscript. The last example returns U because the variable TEST does not exist.

Additional reference words: FoxWin FoxDos 1.00 1.01 1.02 1.21 2.00 2.50 2.50a KBCategory: kbprg KBSubcategory: FxprgGeneral

Last Reviewed: July 5, 1995