User`s manual

Dynamic C Users Manual digi.com 225
#if
#elif
#else
#endif
Syntax: #if constant_expression
#elif constant_expression
#else
#endif
These directives control conditional compilation. Combined, they form a multiple-choice if. When the
condition of one of the choices is met, the Dynamic C code selected by the choice is compiled. Code
belonging to the other choices is ignored.
The #elif and #else directives are optional. Any code between an #else and an #endif is com-
piled if all values for constant_expression are false.
#ifdef
Syntax: #ifdef name
This directive enables code compilation if name has been defined with a #define directive. This direc-
tive must have a matching #endif.
main(){
#if BOARD_TYPE == 1
#define product "Ferrari"
#elif BOARD_TYPE == 2
#define product "Maserati"
#elif BOARD_TYPE == 3
#define product "Lamborghini"
#else
#define product "Chevy"
#endif
...
}