Break Statement

The break statement is used to exit a loop. it is immediately stop loop.

break;

Example

void main() {
  int i = 6;
  switch (i) {
    case 0:
      {
        print("zero"); // This is printed.
      }
      break;
    case 1:
      {
        print("monday");
        break; // This is also printed
      }
    case 2:
      {
        print("tuesday");
        break;
      }
    case 3:
      {
        print("wednesday");
        break;
      }
    case 4:
      {
        print("thursday");
        break; // Syntax error, 'pritn'
      }
    case 5:
      {
        print("friday");
        break; // Syntax error, missing
      }
    case 6:
      {
        print("saturday");
        break;
      }
    default:
      print("sunday");
      break;
  }
}