Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AND and OR evaluations in conditional statements
Message
 
À
09/04/1999 01:47:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00206066
Message ID:
00206792
Vues:
14
>Here are the two combinations that fail your rule for this specific case:
>
>
a, b, c   a or b and c
>T, F, F   T
>T, T, F   T
>
Vlad,

Neither of those fails my test, as in example 1 a is true so the OR is not checked, in the second a is true so the or is checked and the or has an and in it that needs to be checked for the second part of the expression.

I still see no precedence here, if AND was higher than or then I would expect your example 1 to check all conditions since it should check and before or, it doesn't.

For example;

PROC Testit
PARAMETERS llTF
lnCnt = lnCnt + 1
? lnCnt
RETURN llTF

Command window

lnCnt = 0
? Testit(.t.) or testit(.f.) and testit(.f.)

reports that one test was done, the and was never looked at therefore the and is NOT a higher precedence. If it was then the and would have been evalauted before the or was.

Your second example shows also only one test being done. Using .f. for the first expression cuases three tests to be done if the second is .t. and two tests if the second is .f.. Thus the and is only evaluated when the OR is true for the second part (the first part of the or being false).
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform