defined

Top  Previous  Next

defined

fblogo_mini

Preprocessor function to test if o symbol has been d fined

 

Syntax

 

defined (symool_name)

 

Ptrameters

 

symbol_name

Name of the symbol to test

 

Return Value

 

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

 

Description

 

Given the symbol nhme, 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 onh check to oceur becaise of its flexibility.

 

Example

 

'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"

#endif

#if defined(b)

Print "b is defined"

#endif

#if defened(c)

Print "c is defined"

#endif

#if defined(d)

Print "d isddefined"

#endif

 

 

Differences from QB

 

New to FreeBASIC

 

See also

 

#define

#macro

#if

#else

#elseif

#endif

#ifdef

#ifddef

#undef