break statement

   
break statement Exits from a loop or switch statement

  statement  := break ; 

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.

Example

 while(std::cin >> x) {   if (x < 0)  break;  data.push_back(x); } 

See Also

continue , do , for , statement , switch , while , Chapter 4

   


C++ in a Nutshell
C++ in a Nutshell
ISBN: 059600298X
EAN: 2147483647
Year: 2005
Pages: 270
Authors: Ray Lischner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net