Functions and Directives

Function IsMemvar() Foundation

Checks if a symbolic name indicates a dynamic memory variable

IsMemvar( <cVarName>, [<nType>] ) --> lExist
<cVarName> is a character string containing the symbolic identifier of a dynamic memory variable.
Either the #define constant MEMVAR_PRIVATE or MEMVAR_PUBLIC from MEMVAR.CH can be specified for <nType>. This way, the function searches only for memory variables of that particular storage class. Without <nType>, no difference between the PRIVATE and PUBLIC storage class is made.

The function returns .T. (true) if a dynamic memory variable with the name <cVarName> exists, otherwise it returns .F. (false).


The function IsMemvar() checks if a dynamic memory variable exists. IsMemvar() differs from the function Type() by searching for a symbolic name in the symbol table, while Type() returns the data type of a macro-compiled character expression. IsMemvar() can distinguish if a dynamic memory variable is not declared or if it contains the value NIL. This is not possible with the Type() function.

Test if a dynamic memory variable exists

// The example demonstrates the difference between 
// IsMemvar() and Type(). 


   ? Type( "xValue" )          // result:  U 
   ? IsMemvar( "xValue" )      // result: .F. 

   PUBLIC xValue 

   ? Type( "xValue" )          // result:  L 
   ? IsMemvar( "xValue" )      // result: .T. 



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.