`while` Loops

Get started with Kotlin's loop constructs for repeating blocks of code.

We'll cover the following

Kotlin offers the three standard types of loops:

  • while loops
  • do-while loops
  • for loops

As a programmer, loops in Kotlin will feel familiar quickly. Let’s look at a few examples, starting with while and do-while loops.

while Loops #

Kotlin’s while loops have exactly the same syntax and semantics as while loops in Java or C:

Get hands-on with 1000+ tech skills courses.