Solved

What are the Eqv, Imp, and Xor Operators used for?

Posted on 2002-06-26
3
687 Views
Last Modified: 2012-08-14
What are the Eqv, Imp, and Xor Operators used for?

Please give me some good easy-to-understand examples of why you'd use each of these logical operators. I've used the AND OR & NOT before, but I don't understand why you'd use any of the others.

Thanks!

-----

I have documentation on how they work and everything. I'm looking for reasons to use them. Examples in which it would make sense to actually put these to use. Thanks!
0
Comment
Question by:apm825
3 Comments
 
LVL 5

Accepted Solution

by:
rpai earned 100 total points
ID: 7111828
Eqv, Imp, Xor are bitwise operators and are not frequently used.

Eqv is the logical equivalence operator. As a Boolean operator, it returns True if both expressions are either True or False, but it returns False if one is True while the other is False. As a bitwise operator, it returns 1 if both bits are the same (that is, if both are 1 or both are 0), but it returns 0 if they are different.

Imp is the logical implication operator. As a Boolean operator, it returns True unless its first expression is True while the second is False. As a bitwise operator, it returns 1 unless the bit in the first expression is 1 while the bit in the second expression is 0. In VB .NET, Imp can be replaced with a combination of the Not and Or operators for logical operations.
For example,
bResult = (Not bFlag1) Or bFlag2
is equivalent to the statement:
bResult = bFlag1 Imp bFlag2

Xor operator returns a true if one, and only one, of the expressions evaluates to True. For example,
Expr1             Expr2            Result
0                  0                 0
0                  1                 1
1                  0                 1
1                  1                 0



0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7964526
Hi apm825,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept rpai's comment(s) as an answer.

apm825, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 8014766
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA open file from excel cell 4 44
MS Access Search and Replace Using VBA 6 85
VB6 - Compare and highlight cell not the same 3 54
vb6 connector to mongodb 2 122
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question