Kotlin TutorialLesson 14Free preview
Kotlin While Loop
This lesson is part of Kotlin · All levels
Summary
This lesson discusses the repetition of 'while' and 'do...while' in Kotlin. While iteration evaluates the condition before the code is executed, while do. Both of these structures are ideal for iteration cases that rely on dynamic conditions.
Key points
- Repeat 'while' to check the condition at the beginning of each iteration
- The 'do' iteration runs the code block first before checking the condition
- The condition control variable must be modified within the loop to prevent the infinite loop
- Can be combined with break and continue commands
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.