Solved

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

Posted on 2002-06-26
3
567 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now