Syntax
Adds a symbol for #IF with #DEFINE, or removes one with #UNDEF. A symbol has no value: it is defined or not.
#DEFINE <symbol>
#UNDEF <symbol>Also written : #UNDEF
Parts
| <symbol> | One name: letters, digits and _, not starting with a digit. Case is ignored. |
|---|
Good to know
- It applies from its line on, for the rest of the program, files included after it too. A module of
#DEFINEs included first acts as a settings file. - No value and no macros:
#DEFINE LEVEL 3is refused with#DEFINE requires one symbol. For a named value, use#CONSTANT. - A
#DEFINEor#UNDEFinside a dropped#IFbranch does nothing. #UNDEFalso removes a profile symbol: after#UNDEF DEBUG,#IFDEF DEBUGis false even in the editor.- A symbol cannot be read by the running program. It exists only for
#IF,#IFDEFand#IFNDEF.
Example
#DEFINE CHEATS#IF CHEATS AND NOT RELEASEConsole("cheat keys on") ' cheat keys on#ENDIF#UNDEF CHEATS#IFDEF CHEATSConsole("never printed")#ENDIFIn the manual : The preprocessor