# Dart do....while loop

In Dart, the `do...while` loop is similar to the `while` loop, but with one crucial difference: the `do...while` loop executes its block of code at least once, even if the condition is false initially. After the first iteration, it continues to execute the loop as long as the specified condition is true. The syntax of a `do...while` loop is as follows:

```dart
do {
  // Statements to execute
} while (condition);
```

Here's a breakdown of each part:

* `{...}`: This block contains the statements to execute for each iteration of the loop.
    
* `condition`: This is the condition that is evaluated after each iteration. If the condition is true, the loop continues; otherwise, the loop terminates.
    

Here's an example of using a `do...while` loop:

```dart
var i = 0;
do {
  print('Iteration $i');
  i++;
} while (i < 5);
```

In this example:

* `print('Iteration $i')` prints the value of `i` for each iteration.
    
* `i++` increments the value of `i` by `1` after each iteration.
    
* `i < 5` is the condition that is evaluated after each iteration. As long as `i` is less than `5`, the loop continues.
    

The loop will execute five times, just like in the `while` loop example.

One common use case for a `do...while` loop is when you want to execute a block of code at least once, regardless of whether the condition is initially true or not, and then continue looping based on the condition.
