Dart 4 : Loops in Dart

 



// != <><> Loops in Dart <><> !=
// For Loop:
// While Loop:
// Do While Loop:

main() {
// For Loop:
  for (int x = 1; x <= 100; x++) {
    if (x == 56) {
      break;
    }
    print(x);
  }

// While Loop:
  int x = 1;
  while (x <= 10) {
    if (x == 5) {
      break;
    }
    print(x);
    x++;
  }

// Do while Loop:
  int x = 11;
  do {
    print(x);
    x++;
  } while (x <= 10);
}