#IFDEF | #IFNDEF ... #ENDIF Preprocessor Directive

Example   See Also

Conditionally includes a set of commands at compile time if a compile-time constant is defined.

Syntax

#IFDEF | #IFNDEF ConstantName
  Commands
[#ELSE
  Commands]
#ENDIF

Arguments

#IFDEF

Specifies that a set of commands is included at compile time when the ConstantName is defined.

The following describe how a set of commands is included at compile time when you include #IFDEF:

#IFNDEF

Specifies that a set of commands is included at compile time when the ConstantName is not defined.

The following describe how a set of commands is included at compile time when you include #IFNDEF:

ConstantName

Specifies the compile-time constant whose existence determines whether a set of commands is included at compile time. Compile-time constants are defined with #DEFINE.

Commands

Specifies the set of commands that is included at compile time.

Remarks

You can nest an #IFDEF | #IFNDEF ... #ENDIF structure within another #IFDEF | #IFNDEF ... #ENDIF structure.

Comments can be placed on the same line after #IFDEF, #IFNDEF, #ELSE, and #ENDIF. These comments are ignored during compilation and program execution.