76

Implementing C-Style For-Loops In Kotlin

 6 years ago
source link: https://ashishchaudhary.in/implementing-c-style-for-loops-in-kotlin
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Kotlin does not have C-style for-loops. This is fine because I prefer using the idiomatic for-loops (built to use iterators) anyway. But there is a big problem: Kotlin does not allow dynamic limiting conditions in its for-loops (See this thread). This can sometimes get very annoying. To achieve the same functionality, we have to use a while loop.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK