Re: {$ELSEIF} not working in Delphi 2006 ?



Ok,

I think I have found a solution...

By using {$IF} and DEFINED it's now working.

I still don't know why the second example is not working.

Also these different compiler directives $IF and $IFDEF and $IFEND and
$DEFIF is quite confusing !

Using $IFDEF also doesn't work and $ELSEIFDEF does not exist etc... just
weird !

program Test;

{$APPTYPE CONSOLE}

uses
SysUtils;

{$DEFINE C}

begin
// this works:
{$IF DEFINED(A)}
writeln('A');
{$ELSEIF DEFINED(B)}
writeln('B');
{$ELSEIF DEFINED(C)}
writeln('C');
{$IFEND}

// this does not work:
{$IF A}
writeln('A');
{$ELSEIF B}
writeln('B');
{$ELSEIF C}
writeln('C');
{$IFEND}

readln;
end.

Bye,
Skybuck.


.