IFEND directive

 

Type          Conditional compilation

Syntax      {$IFEND}

 

Remarks

The $IFEND directive terminates $IF and $ELSEIF. This allows $IF/$IFEND blocks to be hidden from older compilers inside of $IFDEF/$ENDIF, since the older compilers won't recognize $IFEND as a directive. $IF can only be terminated with $IFEND.  The $IFDEF, $IFNDEF, $IFOPT directives can only be terminated with $ENDIF.

Note:          When hiding $IF inside $IFDEF/$ENDIF, do not use $ELSE with the $IF. Previous version compilers will interpret the $ELSE as part of the $IFDEF, producing a compiler error. You can use an {$ELSEIF True} as a substitute for {$ELSE} in this situation, since the $ELSEIF won't be taken if the $IF is taken first, and the older compilers will not interpret the $ELSEIF. Hiding $IF for backwards compatibility is primarily an issue for third party vendors and application developers who need their code to work on a variety of Delphi and Kylix product versions.

 

Compiler directives (list)

Conditional compilation

IFDEF directive