Dart Loops : Do...While Loop

Dart Loops : Do...While Loop

ยท

1 min read

In dart there are total 5 types of Loops.

  1. For Loop

  2. For....in Loop

  3. For Each Loop

  4. While Loop

  5. Do.....While Loop

In this section we will see about Dart " do... while Loop " .

  • The body of the loop will be executed first and then the condition is tested.
void main() {

    // DO-WHILE Loop

    int i = 1;

    do {

        if ( i % 2 == 0) {
            print(i);
        }

        i++;
    } while ( i <= 10);
}

ย