The directive {$IF expr} will continue the compilation if the boolean expression expr evaluates to True. If the compilation evaluates to False, then the source is skipped to the first {$ELSE} or {$ENDIF} directive.
The compiler must be able to evaluate the expression at parse time. This means that variables or constants that are defined in the source cannot be used. Macros and symbols may be used, however.
More information on this can be found in the section about conditionals, 2.4.1 on page 309.