Show: Delphi C++
Display Preferences

ELSEIF (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Delphi Compiler Directives (List) Index


Conditional compilation




The $ELSEIF directive allows multi-part conditional blocks where at most one of the conditional blocks will be taken. $ELSEIF is a combination of a $ELSE and a $IF.

For example:

{$IFDEF  foobar}
	{$ELSEIF  RTLVersion >= 14}
	{$ELSEIF  somestring = 'yes'}
	    last chance

Of these four cases, only one will be taken. If none of the first three conditions is true, then the $ELSE clause will be taken. $ELSEIF must be terminated by $IFEND. $ELSEIF cannot appear after $ELSE. Conditions are evaluated top to bottom like a normal "if ... else if ... else " sequence. In the example above, if foobar is not defined, RTLVersion is 15, and somestring = 'yes', only the "blah" block will be taken not the "beep" block, even though the conditions for both are true.

See Also

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions