Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2002-06-26
3
Medium Priority
?
942 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 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

715 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