And & Equ

JonyBravo

Registered User.
Local time
Today, 22:08
Joined
Jan 17, 2006
Messages
89
Hi everyone

Can someone explain me please the difference between AND & EQU?
I'm using the following code:

if (txt1 > txt2 AND txt1 < txt3) then

This doesn't work when I run the program. Is there anyone that can tell me why?
Thanks
 
Truth tables:

AND: 1 AND 1 --> 1, all other combos -->0
EQU: 1 AND 1 --> 1, 0 AND 0 --> 1, other combos -->0

As far as your code goes, the English is:

Do the conditional statement if text string 1 is higher in collating sequence than text string 2 AND if text string 1 is lower in collating sequence than text string 3.

So... how do you know it doesn't work? (What SPECIFIC condition tells you your answer is wrong?) If you input three text strings for text 1, text 2, and text 3, you should be able to compare them with the rules I just gave you.
 
Last edited:
Thank you The_Doc_Man for your help
 
Just for reference, some common logic functions you sometimes see

AND: true if both inputs are TRUE
EQU: true if both inputs are the same (EQUIVALENCE)
OR: true if either input is TRUE (inclusive OR, either/or)
XOR: true if the two inputs are different (exclusive or)

All of the above are order-independent.

You also sometimes see

IMP: FALSE if first input is TRUE and second input is FALSE (logical implication). AS A STATEMENT, A IMP B is TRUE if A is FALSE because then the state of B is immaterial.

and, of course, the unary operator: NOT: FALSE if input is TRUE and vice-versa.

EQU can be expanded as (A AND B) OR ( ( NOT A) AND (NOT B) )
XOR can be expanded as (A AND (NOT B) ) OR ( (NOT A) AND B)
IMP can be expanded as NOT (A AND (NOT B) ) which, via De Morgan's Theorem, is also expanded as (NOT A) OR B
 
AND: 1 AND 1 --> 1, all other combos -->0
EQU: 1 AND 1 --> 1, 0 AND 0 --> 1, other combos -->0

Yes, but I believe true is identified by a -1 anything other than -1 is False (default 0).
 

Users who are viewing this thread

Back
Top Bottom