Kotlin 1.7.20 comes with a new Kotlin rangeUntil operator (preview): ..< In order to use the new operator, you need to enable the -language-version 1.8 flag. You can set the language-version 1.8 in build.gradle.kts: An experimental annotation must be added, e.g.: @OptIn(ExperimentalStdlibApi::class) and the new rangeUntil operator has the same functionality that the until operator: Source Code gb.com/ls/Kotlin-Ranges-New-Until