Browse topics
Kotlin Basics
Looping & Controls
Repeat work with for, while, do-while and the repeat function.
Kotlin Loop ControlsDo..While Loop and Its Usage in KotlinA Do..while loop is similar to while loop except that the condition will be checked after the block of code is executed.Kotlin Loop ControlsFor Loop and Its Usage in KotlinIn Kotlin, for loop is used for looping a certain block based on Range and Array. A Kotlin example with source code and sample output.Kotlin Loop ControlsRepeat and Its Usage in KotlinRepeat 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.Kotlin Loop ControlsWhile Loop and Its Usage in KotlinWhile Loop and Its Usage in Kotlin: a complete example program with source code and sample output, explained step by step.kotlin loop controlsbreak and continue in Kotlinbreak exits the nearest enclosing loop immediately. A Kotlin example with source code and sample output.kotlin loop controlsLabeled Return in KotlinA label lets you return from a specific function or loop, not just the innermost lambda. A Kotlin example with source code and sample output.
Related topics
Basic Programs Get started with Kotlin: your first program, variables, and comments. Kotlin Data Types Explore Int, Float, Double, Char, Boolean, String and more, with type conversion. Kotlin Operators Arithmetic, relational, logical, assignment and Kotlin's special operators. Conditional Statements Control program flow with if, when, break, continue and return. Kotlin Input and Output Read input and print output in Kotlin, including the Scanner class. Kotlin Functions Define functions with default, named and vararg parameters, single-expression, local, tailrec and infix functions.