Setup – New Kotlin Range Operator: rangeUntil

Kotlin 1.7.20 comes with a new Kotlin rangeUntil operator (preview):

..<

~ 1 minutes read

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:

source code

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

Source Code

1 Comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.