No. I tried:

if true and not false then
   ShowMessage('Hi');

This works fine. So does

if (true) and not (false) then
   ShowMessage('Hi');

However,

if true and not then

came up with a compile error.


What I suspect that Delphi does is interpret the thing from left to right.

So if A and B and C and D becomes: if (((A and B) and C) and D)

if A and not B and C and D becomes: if (((A and (not B)) and C) and D)


-----Original Message-----
From: Steve Peacocke [mailto:[EMAIL PROTECTED]
Sent: Monday, 10 March 2003 1:28 p.m.
To: Multiple recipients of list delphi
Subject: Re: [DUG]: coding


Alistair George said:
> Hi All.
> The following:
> if (DateSwitch) and not (RxCheckListBox6.Checked[2]) then
> CheckFileExist(VCLzip1.zipname); is not parsed correctly unless it is:
> if (DateSwitch) and (not RxCheckListBox6.Checked[2]) then
> CheckFileExist(VCLzip1.zipname);

Here's what Delphi is doing...

>if (DateSwitch) and not (Checked) then
If (true) and false(false) then

Delphi is not interpreting the line further than "not" as this equates to
false.

Where you have the brackets shown correctly the (not checked) is
interpreted as..

>if (DateSwitch) and (not Checked) then
If (true) and (true) then

Hope this helps (also secretely hopes this is a correct guess).

Steve


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to