
-----------------------------------
ownageprince
Wed Jan 03, 2007 10:31 pm

Difference between break; and continue;
-----------------------------------
Sorry if its a dumb question...i tried them out and i think that they do same thing...i tried them in if structures and switch...so can anyone please explain the difference because why make two separate commands that do the same thing right?

-----------------------------------
wtd
Thu Jan 04, 2007 12:14 am


-----------------------------------
In a loop, continue will advance immediately to the next step through the loop.

-----------------------------------
r.3volved
Thu Jan 04, 2007 1:53 pm


-----------------------------------
....break will break you out of the loop and run the code that follows it

try this and see the difference:

int x = 0;
for( x; x != 10; ++x ) {
   if( x == 5 ) break;
}
cout 