Search code examples
mathematical-notation

What does this square bracket and parenthesis bracket notation mean [first1,last1)?


I have seen number ranges represented as [first1,last1) and [first2,last2).

I would like to know what such a notation means.


Solution

  • A bracket - [ or ] - means that end of the range is inclusive -- it includes the element listed. A parenthesis - ( or ) - means that end is exclusive and doesn't contain the listed element. So for [first1, last1), the range starts with first1 (and includes it), but ends just before last1.

    Assuming integers:

    • (0, 5) = 1, 2, 3, 4
    • (0, 5] = 1, 2, 3, 4, 5
    • [0, 5) = 0, 1, 2, 3, 4
    • [0, 5] = 0, 1, 2, 3, 4, 5