2 ms·
On the other hand, it's easier to determine the number of items in a range if it is exclusive; range(n, m) contains abs(m - n) items. Also, inclusive doesn't a
by Someone 10y ago
On the other hand, it's easier to determine the number of items in a range if it is exclusive; range(n, m) contains abs(m - n) items.
Also, inclusive doesn't allow you to specify empty ranges. That may mean having to add if statements to your code, making it uglier.
I would prefer using notations [m,n) and [m,n], even though that uses a notation used in mathematics for a set to specify a sequence.
Of course, one would want (m,n) and (m,n], too, then, but that first one probably would make parsing your language difficult.