Looping & Controls
Repeat work with for, while, do-while and the repeat function.
Do..While Loop and Its Usage in Kotlin
A Do..while loop is similar to while loop except that the condition will be checked after the block of code is executed.
For Loop and Its Usage in Kotlin
In Kotlin, for loop is used for looping a certain block based on Range and Array. A Kotlin example with source code and sample output.
Repeat and Its Usage in Kotlin
Repeat statement is like while loop, which executes a block of code N-number of times (without any condition). A Kotlin example with source code and sample output.
While Loop and Its Usage in Kotlin
While Loop and Its Usage in Kotlin: a complete example program with source code and sample output, explained step by step.
break and continue in Kotlin
break exits the nearest enclosing loop immediately. A Kotlin example with source code and sample output.
Labeled Return in Kotlin
A label lets you return from a specific function or loop, not just the innermost lambda. A Kotlin example with source code and sample output.