Back home Next view contents in a pop up window
Go to: if - if else - switch - while / for / do
The continue
command.
The continue command tells the program to ignore the immediate line fallowing the continue command. Its a very simple command. Here is one example.
program 1.12
#include <iostream.h>
int main () {
int count;
for (count=0; count <11; ++count)
{
if (count==3)
continue;
cout << count << endl;
}
return 0;
}
output from 1.12
| 0 1 2 4 5 6 7 8 9 10 Press any key to continue |
This is a simple program. The program has been told to start counting from zero up to 10. Pay attention to the output though and you wont see the number 3. Notice in lines five and six the two commands. if (count==3) continue; Here it simply says that if the variable count is equal to 3, skip it and go to the next line. Thus it skips the number and jumps to number 4. Its a pretty straight foward command.
Back home Next view contents in a pop up window
Go to: if - if else - switch - while / for / do