A range represents an interval or a set of real values. Each value in this set lies between two other values, which represent the start and the end of the range. Kotlin has classes that represent ranges and functions for its creation.
There are three common types of range:
- A range of variables: A set of values defined by start and end values (for instance, the range -3 to 3 includes -3, -2, -1, 0, 1, 2, and 3)
- The range of an array: A range that's bound by the first and last values of an array
- The range of an iterator: This means that the range can be iterated over each value
In this chapter, we will cover the following topics:
- Ranges in Kotlin
- Range benchmarking