Preprocessor function to test if a symbol has been defined

defined (symbol_name)

Name of the symbol to test

Return Value:
Returns non-zero (-1) if the symbol has been defined, otherwise returns zero (0).

Given the symbol name, the defined() preprocessor function returns true if the symbol has been defined - or false if the symbol is unknown.

This is used mainly with #if.

Similar to #ifdef except it allows more than one check to occur because of its flexibility.

'e.g. - which symbols are defined out of a, b, c, and d ?

Const a = 300
#define b 12
Dim c As Single

#if defined(a)
 Print "a is defined"
#if defined(b)
 Print "b is defined"
#if defined(c)
 Print "c is defined"
#if defined(d)
 Print "d is defined"

Differences from QB:
See also:
Back to Preprocessor
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki phatcode