Always use intervals [closed, open)
Intervals or ranges appear all over the world of programming. The classic example is choosing a start and end date, like you would when booking an AirBnB or a flight. But that's just one example: from slicing a JS array to Java's #sublist and even SQL's LIMIT operator, ranges are everywhere.
Have you ever wondered why they are always implemented as [closed, open) as opposed to [closed, closed]?
Wait, what is an interval [closed, open)?A closed-open interval, usually denoted [a, b) is only an abbreviated form to express a
Intervals or ranges appear all over the world of programming. The classic example is choosing a start and end date, like you would when booking an AirBnB or a flight. But that's just one example: from slicing a JS array to Java's #sublist and even SQL's LIMIT operator, ranges are everywhere.
Have you ever wondered why they are always implemented as [closed, open) as opposed to [closed, closed]?
Wait, what is an interval [closed, open)?A closed-open interval, usually denoted [a, b) is only an abbreviated form to express a
What's Your Reaction?