Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AND and OR evaluations in conditional statements
Message
De
11/04/1999 21:04:02
 
 
À
11/04/1999 17:13:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00206066
Message ID:
00207341
Vues:
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.

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.

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

Cheers,

Jim N


>>I was understanding you all along until this line:
>>>
>>>I wanted to say that "a or b and c" is in fact "a or (b and c)". That doesn't mean the operation between parentheses is evaluated first.
>
>You are right, this was not clear at all! :( I wanted to say that it doesn't mean that the operands of the operation between parentheses are evaluated first. (But the "and" IS evaluated before "OR".) For ex, VFP can evaluated "a" first. If "a" is .T., the result of the "and" doesn't matter anymore and it's never evaluated. This creates the ilusion that the "or" is evaluated before "and". This is not true. What happens here is in fact an optimization for logical expressions. But if "a" is .F., the "and" is evaluated, and this is done before "or".
>
>So, you are right. Sorry I was so fuzzy.
>
>Vlad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform