Android Kotlin tutorial on while loop || While Loop


While loop is a much simpler form of looping and is purely based on the condition defined at the beginning of the loop.

The condition is of the form boolean condition such that when the condition is satisfied the loop gets finished, to know much more lets get in to the tutorial..


In previous tutorial on Kotlin we have dealt with the For Loop.  May have a look here For-Loop.


Kotlin while loop is explained using a small scenario where we want a print numbers starting from 1 to 10.


Declare a variable

var abc = 1


Condition for while loop i.e., we want the loop to run until abc increments upto 10

while(abc < 10)


Now add a print statement of variable



Now the most important step is to make increment of the variable abc



Execution :


while(abc < 10){




If you have any query on kotlin while loop tutorial do let us know in the comment section below.If you like this tutorial do like and share us for more interesting updates.

For more info visit the video tutorial given below.



Show Buttons
Hide Buttons
Read previous post:
Android Kotlin Tutorial on For Loop || For Loop

  What is a loop? A loop is a process where we continuous loop through a given list of items...