Friday, June 29, 2018

Continue and Break Statements

You can use continue and break statements within all three loops to tell the
execution to break or continue.
The
break statement completely interrupts a loop at any time. The best example
of a
break is in a switch statement.
The continue statement ignores the rest of the current loop and continues to
control the loop. The following example uses a
for loop with the continuestatement to control which values print to the screen. The loop executes the print
statement for values <= 3 and >= 8.
int counter;
for (counter=1;counter <= 10;counter++)
{
if (counter > 3 && counter < 8)
{
continue;
}
print counter;
}
pause;
Result:
1
2
3
8
9
10


Best Regards,
Hossein Karimi

No comments:

Post a Comment

Configure the Firewall on the Enterprise Portal Server

After you install Enterprise Portal, enable Web Server (HTTP) in Windows Firewall. If you do not enable the web server in Windows Firewall...