2/6/00
COM1100 Winter2000 Yuhong Yin
8
break statement example
n
for (int i = 1; i <= 10; i++) {
n
int r = i % 3;
n
if ( r == 0 ) {
n
break;
// jump out of for statement
n
}
n
else {
n
cout << " i = " << i;
n
}
n
}
n
cout << “\n End of loop” << endl;
n
n
Output : i = 1 i = 2
End of loop