Kotlin TutorialLesson 18Free preview
Kotlin Ranges
This lesson is part of Kotlin · All levels
Summary
This lesson unpacks the expressive range features of Kotlin. The range of values facilitates the declarative creation of a series of numbers or characters. This lesson guides the use of the operators '..', 'downTo', 'step', and 'until' to control the range limit.
Key points
- Operator '..' creates an inclusive range from start to finish (example: 1.5. includes 5)
- The 'until' infix function makes the half-open range (excluding the end limit)
- The 'downTo' infix function is used to make the range down (count back)
- The 'step' infix function determines the multiplication of the jump between values in the range
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.