DIRECTIVEPublished
#else and #endif
#ifdef <id> ... #else ... #endifProvides the alternative path and closes conditional compilation blocks.
Overview
#else separates the alternative for #ifdef or #ifndef, and #endif closes the block. Unlike runtime If/Else/EndIf, these directives select source text before compilation.
Syntax
#ifdef <id> ... #else ... #endifTwo compilation variants
User Function ExAlternativa()
#ifdef VERSAO_ESPECIAL
MsgInfo("Recurso da versão especial")
#else
MsgInfo("Comportamento padrão")
#endif
ReturnExpected result
Only the matching alternative reaches the compiler.
- Indent content to expose the conditional structure.
- Keep opening and closing directives close when practical.
- They do not replace runtime Else and EndIf.
- Deeply nested blocks obscure which variant was compiled.
