Information générale
Catégorie:
Codage, syntaxe et commandes
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement