>I'm not sure about using parentheses, I've been told by Microsoft support that they can affect how code works.
>
>Some years ago, I had a problem with Foxpro 2.5 and an SQL select returning unexpected results, after several calls, one support engineer asked to see a copy of the code, which was in the form :
>
>select ..... where (a=b) AND (c=d) AND (e=f)
>
>he asked me why the parentheses were there - so I told him to aid readability - & in all seriousness he told me that they weren't necessary & if I removed them then the select would work correctly.
>
>(At that point, I was actually desperate enough to try & of course it didn't work. Since then I've been very dubious about the quality of MS tech support.)
I am a big fan of parentheses. I do believe that not only can it afford better readability in a particularly complex logical evaluation, it is also a clean and sure way to force or obtain a logical evaluation in a particular order.
For example take the expression where d and e are actually equal values, and a, b, and c are discrete and different from d
IF a=b AND b=c OR d=e
if my memory serves me, VFP will evaluate the expression left to right and the result will be TRUE. If we place a parentheses thus,
IF (a=b AND b=c) OR d=e, the result will be TRUE again. However, if we shift the parentheses, and consider a=b AND (b=c OR d=e), the result is FALSE.
Len, in your example with 2 AND's, a bracket will make no difference to the outcome.
Sanjay Kapoor
Relatively speaking is a conversation with Einstein