PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: #if[Next]: #ifndef

#ifdef

A #ifdef command (like #if and #ifndef) can be used to conditionally include lines of text, this can be any other type of line or command except #elseif or #endif.

#if commands can be nested to any level and there need not be any lines between a #if command and a #endif or #elseif command.

Note that this command only checks on a single variable, for more complex requirements you will need to use a #if command along with calls to the Defined() routine. For performance reasons it is recommended that you use #ifdef and #ifndef commands where possible.

A common use of this command is as a method of creating block comments. Simply specify a variable you know does not exist!

Syntax

    [WhiteSpace]#ifdef  MacroName
    

The "MacroName" specifies the name of a macro that should exist for the test to evaluate to true.

Example #1

    #define Fred FredsValue
    #ifdef Fred
        ...
    #endif
    

Example #2 - Block Comment

    #ifdef DoesNotExist
           <P>This paragraph
           has been commented out
           as we are testing for
           a variable we
           know does not exist.
    #endif
    


[Top][Contents][Search][Prev]: #if[Next]: #ifndef

PPWIZARD Manual
My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Thursday January 17 2002 at 6:27pm