Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
True or False
Message
From
16/01/2007 10:55:53
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01185857
Message ID:
01185910
Views:
9
>>>We now know we were wrong and why. But does anybody here (except Sergey, who obviously appears to know why) know why?
>>
>>The precedence of AND means that AND is evaluated first (like multiplication) and then the OR (like addition). So your expressions basically read as
>>
>>
? .f. or .t. or (.f. and .f.) or .f.
>>? .f. or .f. or (.t. and .f.) or .f.
>>
>>The precedence of conjunction over disjunction makes parentheses unnecessary, hence they need not be written. It always behaves as if they are.
>
>Yes, you are right. Nevertheless, my suggestion to other developers is to use the parentheses anyway. I always use the (formally unnecessary) parentheses anyway and today I was confronted with a piece of source code without the parentheses. It initially really puzzled me.

You're not the only one - I've seen here on UT logical expressions where parentheses were added for clarity. Let's face it, a logical expression with five terms or more is not exactly a roadsign to be understood in a millisecond. And for many people it's a bit over their head.

I once had a case of a logical expression which extended over eight lines (in Cobol :). It took me good ten minutes to reduce it to an equivalent two-liner. The person who wrote that was an economist. That taught me that while I have the feeling the logical expression are easy to do, I may not share that feeling with all the people :).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform