Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AND and OR evaluations in conditional statements
Message
From
12/04/1999 21:29:33
 
 
To
11/04/1999 21:04:02
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00206066
Message ID:
00207668
Views:
11
>Pardon my nose here Vlad, but does " But if "a" is .F., the "and" is evaluated, and this is done before "or". " make sense... after all, for "a" to be known to be false, it has to have already been evaluated.

So, my statement doesn't make sense (?). Probably it makes sense only in MY English. :) As I said in a previous message, the precedence of operators gives the way to group operands, not the sequence (in time) to evaluate operands. My statement wanted to say:
1. The "and" operation is evaluated only if "a" is .f.
2. If "a" is .f., the result of the "and" operation is evaluated before the result of the "or" (which will be the final result).

Does it make sense now?

>And don't forget that we know, because of a prior bug in FP/VFP with syntactical-error/type-mismatch in non-first expressions of compound logical expressions, that evaluation always proceeds left to right.

We know that from the help (See "Creating Logical Expressions"). This is true as long as all operations have the same priority. This rule cannot beat the normal precedence of operators. And the sequence of operation evaluation is not necessarily the same as the order of operands evaluation. The example in this thread proves it.

>The precedence involved here has to do with the operators and which operands will be attached to which - *not* to the actaul expressions themselves.

How come the operator's precedence doesn't have anything to do with the expressions themselves?

Vlad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform