I was in fact trying to simply say that the previous reply to mine was wrong, and 
rather than try and quote off the top of my head technical bits of help (which I have 
read, but a long time ago) when it's easy to get them wrong (indeed, I mis-remembered 
the precedence of not) I thought it safer to prove by example.

-----Original Message-----
From: Conor Boyd [mailto:[EMAIL PROTECTED]
Sent: Monday, 10 March 2003 2:06 p.m.
To: Multiple recipients of list delphi
Subject: RE: Re: [DUG]: coding


It's not really a question of 'suspicion', really. ;-)

It's all documented in the Delphi Help and various other places.  Look up
Operator Precedence Rules in the Delphi help for example.

Also, if you haven't come across it already, it's worth reading the section
on Complete vs short-circuit Boolean evaluation as well.

The reason your last example won't compile is simply that 'not' is an
operator, not an expression.

Cheers,

Conor

-----Original Message-----
From: Allan, Samuel [mailto:[EMAIL PROTECTED]

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)
---------------------------------------------------------------------------
    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