What is the difference between Inclusive and Exclusive OR?

情到浓时终转凉″ 提交于 2019-12-03 02:00:44
  • Inclusive or: A or B or both.
  • Exclusive or: Either A or B but not both.

A B OR XOR  
1 0  1  1  
1 1  1  0  
0 1  1  1  
0 0  0  0  

Considering the value for the statement "A OR B":

Inclusive OR allows both possibilities as well as either of them. So, if either A or B is True, or if both are True, then the statement value is True.

Whereas Exclusive OR only allows one possibility. So if either A or B is true, then and only then is the value True. If both A and B are True, even then the statement's value will be False.

Example for Exclusive OR: At a restaurant, you are offered a coupon which entitles you to eat either a Sandwich OR a Burger. This is an exclusive OR statement in English language. You can choose either one of them, but not both.

The difference is what happens with both components are true. With inclusive or, the result is also true. With exclusive or, the result is false.

Exclusive or is kinda like Highlander: There can be only one. :-)

INCLUSIVE 'OR' : Logic OR means its output is 'ON' if any of the input is 'ON'. It includes 'both' inputs are 'ON' (At least one input is 'ON').

EXCLUSIVE 'OR' : It is same as Inclusive OR, with the (only) EXCEPTION is while 'both' inputs are 'ON' then the output goes OFF, (NOT ON as in the Inclusive OR) and hence the name EXCLUSIVE 'OR'.

as a result table:

inclusive or:

A B Result
0 0 0
1 0 1
0 1 1
1 1 1

exclusive or:

A B Result
0 0 0
1 0 1
0 1 1
1 1 0

so, aus you can see, an exclusive or give false if both are true, cause its exclusive means A or B but not both

well on a totally different note - and getting back to everyday English conversation the inclusive/exclusive thing can be made clearer:

Do you want tea or coffee? (meaning, fancy something to drink?) = inclusive or Do you want tea or coffee? (meaning you have to choose between the two) = exclusive

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!