inclusive and exclusive

Inclusive - Including the last number
Exclusive - Excluding the last number

In Computer Science, inclusive/exclusive apply to a number range

Example

inclusive

If a function will compute $2^i$ where $i = 1, 2, …, n$.

$i$ can have values from 1 up to and including the value n.

We says, n is Included in Inclusive

1 through 10 (inclusive) = [1, 10]
1 2 3 4 5 6 7 8 9 10

exclusive

If a function will compute $2^i$ where i = 1, 2, ..., n

i can have values from 1 up to and including the value n-1. Which means

i can have values from 1 up to and excluding the value n.

We says, n is excluded in exclusive.

1 through 10 (exclusive) = [1, 10)
1 2 3 4 5 6 7 8 9

 Share!

 
comments powered by Disqus