Char and Custom Ranges
Beyond integers.
Beyond Integers
Ranges are not just for Int. Kotlin supports ranges of characters and other comparable types.
This lesson explores char ranges and how custom types can join in with rangeTo.
Char Ranges Recap
Characters have a defined order, so 'a'..'z' is a valid range.
You can iterate, check membership, and more.
fun main() {
for (c in 'a'..'f') print(c)
println()
println('q' in 'a'..'z')
}All lessons in this course
- Range Operators
- Step and downTo
- Ranges in Loops
- Char and Custom Ranges