In the comment section of this article, it was a story like whether n..m includes m, so I investigated and summarized it. It is represented by open intervals, closed intervals and [n, m), [n, m].
Since some languages are not used normally, please point out any mistakes.
n and m are natural numbers in the range that does not overflow, or 0 and n <m.
Rust
n .. m //m is not included
It's a derivative of Rust's article, so for now, Rust. m is not included.
Python
range(n, m)
does not include m. However, random.randint (n, m) has some complications such as including m.
Java
The IntStream class has a Range function and a RangeClosed function.
...Array(m).keys()
This is a special case, but m is not included.
Ruby
n..m #Including
n...m #Not included
Image that beginners have more points to learn first
Elixir
n..m #Including
Elixir range types include m. It's very similar to Ruby.
PHP
range(n, m)
Including m
Kotlin
n..m
Includes m.
Swift
n...m //Including
n..<m //Not included
Scala
Range(n, m, 1) // [n, m),Interval 1
n to m //Including m
n until m //does not include m
Even similar languages are treated differently and are very confusing.
I mainly wrote the languages I know, so there may be biases and omissions.
Postscript: Which is the mainstream is a classification that does not make much sense, so it was abolished.
Recommended Posts