continue and break change a loop's normal flow. continue skips the rest of the current iteration and resumes at the next condition check (plus the for step if any). break exits the loop immediately, ignoring later iterations entirely. Both are useful for guarding the body's happy path and for bailing out as soon as a stop condition is met.

Program

Play the program to loop over 1..5, continue on 2, break on 5, and keep [1, 3, 4].

break_continue.dart
void main() {
  var kept = <int>[];
  for (var n = 1; n <= 5; n++) {
    if (n == 2) continue;
    if (n == 5) break;
    kept.add(n);
  }
  var summary = kept.join(',');
  print('kept=$summary');
}
continue `continue` skips the rest of the current iteration and jumps to the next condition check (and the `for` step). The body's later statements are not run for that iteration.
break `break` exits the loop immediately. No condition check, no increment step, no remaining iterations.
guard before work Putting `continue`/`break` early keeps the rest of the body as the normal happy path. The loop ran for `n = 1..5` but only added `1, 3, 4` because `2` was skipped and `5` triggered exit.