Table of Contents
Inclusion, or “inclusivity” in logic and computer science broadly refers to a quality inherent to certain expressions. Specifically, an expression is inclusive if a proposed range of an expression includes the start and end point of that range. Take this expression as an example:
Computer Science
X = greater than 5 AND smaller than 10
In a strict sense, 5 is not greater than 5. A number greater than 5 would be 5.00001, but not 5. Whether an application still counts 5 as being within the range of the original expression depends on how it is built.
For example, number ranges: What are the numbers from 5 to 10? That would be 5, 6, 7, 8, 9 and 10. But one could also say, depending on how they interpret it, 5, 6, 7, 8 and 9.
Both are correct, but one is inclusive, the other exclusive.
Logic
In logic, inclusivity describes whether an expression includes itself. Follow through this example:
AND is a logical operator that returns true if TWO conditions are met at the same time. A kid can have:
(Ice Cream) AND (Candy)
It gets both.
OR, on the other hand, returns true if at least one of the conditions is met. What does the kid hold in its hands?
(Ice Cream) OR (Candy)
Imagine you are asked “does it hold candy or ice cream?”, you look at the kid and find that it holds both, but you can only respond with “yes” or “no”, you would say “yes”.
XOR is an exclusive or. It returns true only when one, and only one condition is met.
(Ice Cream) XOR (Candy)
The child can have ice cream XOR candy - ie. one or the other, but not both.1)