How to While Loop in Kotlin? | while and do while

Опубликовано: 16 Октябрь 2024
на канале: Ludwig Dickmanns
654
22

While Loops in Kotlin!
In this video, you're going to learn how to use while loops and do-while loops in Kotlin. With them, you can execute a block of code for as long as a condition is satisfied. The main difference between the while and do-while is the condition checking time. while first checks the condition, then, it executes the body and then does the next check. do-while first executes the body and then does the check. Therefore, the body of the do-while loop is executed at least once.

00:00 Intro
00:16 Documentation of While Loops
00:49 While Loop - Simple Example
01:46 While Loop - Practical Example
02:55 Do While Loop - Motivation
03:15 Do While Loop - Refactoring
03:47 Outro

Documentation for Kotlin While Loops and Kotlin Do-While Loops:
https://kotlinlang.org/docs/basic-syn...
https://kotlinlang.org/docs/control-f...

@kotlin.learnings on Instagram:
  / kotlin.lear.  .
@java.learnings on Instagram:
  / java.learnings  

Thank you for watching!