Solved

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

Posted on 2002-06-26
3
750 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

752 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