The break statement exits from the nearest enclosing loop (do, for, or while) or switch statement. Execution continues with the statement immediately following the end of the loop or switch. An error results if break is used outside of a loop or switch statement. Examplewhile(std::cin >> x) { if (x < 0) break; data.push_back(x); } See Alsocontinue, do, for, statement, switch, while, Chapter 4 |