RAD Studio (Common)
ContentsIndex
PreviousUpNext
IFEND directive (Delphi)
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: 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 versions and platforms.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!