DartLang
π― Dart (DartLang) Introduction: while and do-while loops
Dart supports while
and do-while
loops. In contrast with for loops, while and do-while loops run until some condition is met.
Dart supports while
and do-while
loops. In the case of while(condition){}
loop, statement inside while
block is only executed when condition
is true
. However, in the case of do{} while(condition)
loop, do
block is executed first and then the condition
is checked in the while
block.
Both while
and do-while
loops supports break
and continue
keywords just like for
loops and both these keywords only affect the current loop just like how they behave in for
loop.
We can also use labels with while
and do-while
loops to continue or terminate a specific loop using break
and continue
keywords.