contents   index   previous   next



#if <constant expression>
#elif <constant expression>
#ifdef <name>
#ifndef <name>
#else
#endif

These conditional compilation preprocessor commands are used to include/exclude text from the resulting .java file. The if command includes or excludes text based on a constant expression, which is subject to macro expansion. If the constant expression is true, then the all of the text following the #if up to the next #endif is included in the output file. If the expression is false, the text following the #if is ignored. The #else and #elif commands must follow an #if command and are only evaluated if the corresponding #if expression is false. The #if , #else, and #elif commands work together like the Java if, else, and else if statements.

 

The defined operator is available for use in #if and #elif statements. This operator results in 1 if the specified name is defined as a preprocessor macro, 0 otherwise.

 

The #ifdef command includes text if the specified macro has been defined and excludes text if the macro has not been defined. The #ifndef command is the inverse of the #ifdef command.

 

The #endif command is used by all of the other conditional compilation commands to determine where to stop including/excluding text.

 


#error