Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AND OR Logic
Message
De
17/12/2008 22:34:54
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
17/12/2008 21:21:20
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01368370
Message ID:
01368387
Vues:
6
>Are the results of these different?
>
>!EOF() OR !BOF()
>!EOF() AND !BOF()
>
For your reference, here is some boolean logic.

First, the easy part, some truth tables. Note the difference between AND and OR, in the second and third rows.
A   NOT A
T     F
F     T

A   B   A AND B
T   T      T
T   F      F
F   T      F
F   F      F

A   B   A OR B
T   T      T
T   F      T
F   T      T
F   F      F
! or NOT has a higher priority than AND and OR, by the way. (While AND has a higher priority than OR, this can be confusing, so parentheses are recommended if there is any possible confusion.)


Also interesting in this case are De Morgan's Laws, which state that
not (a and b) = (not a) or (not b)

not (a or b) = (not a) and (not b)
(Note that the AND is changed to OR and vice versa.)

Applied to the present case, and considering the additional identity
not (not A) = A
your conditions might be rephrased as follows:
>!EOF() OR !BOF() --> not (eof() and bof())
>!EOF() AND !BOF() --> not (eof() or bof())
As stated previously, the first condition can't ever be true if there is at least one record.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform