
- Dart Programming - Home
- Dart Programming - Overview
- Dart Programming - Environment
- Dart Programming - Syntax
- Dart Programming - Data Types
- Dart Programming - Variables
- Dart Programming - Operators
- Dart Programming - Loops
- Dart Programming - Decision Making
- Dart Programming - Numbers
- Dart Programming - String
- Dart Programming - Boolean
- Dart Programming - Lists
- Dart Programming - Lists
- Dart Programming - Map
- Dart Programming - Symbol
- Dart Programming - Runes
- Dart Programming - Enumeration
- Dart Programming - Functions
- Dart Programming - Interfaces
- Dart Programming - Classes
- Dart Programming - Object
- Dart Programming - Collection
- Dart Programming - Generics
- Dart Programming - Packages
- Dart Programming - Exceptions
- Dart Programming - Debugging
- Dart Programming - Typedef
- Dart Programming - Libraries
- Dart Programming - Async
- Dart Programming - Concurrency
- Dart Programming - Unit Testing
- Dart Programming - HTML DOM
Dart Programming - do while Loop
The dowhile loop is similar to the while loop except that the do...while loop doesnt evaluate the condition for the first time the loop executes. However, the condition is evaluated for the subsequent iterations. In other words, the code block will be executed at least once in a dowhile loop.
The following illustration shows the flowchart of the dowhile loop −

Following is the syntax for the do-while loop.
do { Statement(s) to be executed; } while (expression);
Note − Dont miss the semicolon used at the end of the do...while loop.
Example
void main() { var n = 10; do { print(n); n--; } while(n>=0); }
The example prints numbers from 0 to 10 in the reverse order. The following output is displayed on successful execution of the above code.
10 9 8 7 6 5 4 3 2 1 0
dart_programming_loops.htm
Advertisements