Function IsMemvar() Foundation

Checks if a symbolic name indicates a dynamic memory variable

Syntax
IsMemvar( <cVarName>, [<nType>] ) --> lExist
Parameters
<cVarName>
<cVarName> is a character string containing the symbolic identifier of a dynamic memory variable.
<nType>
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.
Return

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

Description

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.

Examples
Test if a dynamic memory variable exists

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

PROCEDURE Main 

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

   PUBLIC xValue 

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

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.