break statement in c++
- The break statement causes an immediate exit from a loop. Because the code that follows it in the loop is not executed if the break is reached, you can also sometimes avoid nesting by including a break.
- It is possible to force an immediate exit from a loop, bypassing the loop’s conditional test, by using the break statement.
- The break keyword causes the entire switch statement to exit.
using namespace std;
// Loops from 0 to 9, not to 100!
for(t=0; t<100; t++)
break; cout << t << ' ';
0 1 2 3 4 5 6 7 8 9