User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







cpp:control_structures:break

Table of Contents

break

   syntax
   break;
   
   Description: break ends a loop immediately

cpp Sourcecode Example

#include <iostream> /* including standard library */
 
using namespace std;
int main ( void ) {
 
int i;
i=0;
 
while (1) {
    i++;
    if (i==42) {
        break;
        }
  }
 
cout << "The answer is " << i <<;
return 0;
}

output

  The answer is 42

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
cpp/control_structures/break.txt · Last modified: 2024/02/16 01:04 (external edit)

Impressum Datenschutz