تا جایی که یادمه کانتینیو وقتی شرطش برقرار باشه انگار بپره حلقه را از اول اجرا کنه(یعنی سیکل جاری خاتمه یابد و سیکل بعدی شروع شود) و بقیه حلقه اجرا نشه. برای سینتکسش سرچ کن. ولی فکر کنم مثل هر شرطی با if و شرط داخل پرانتز بعدش کانتینیو و بعد سمی کلون.
ولی دستور بریک کلا از حلقه بیرون می پره و دیگه هیچ قسمتی از حلقه اجرا نمیشه.
به نقل از:
http://www.meshplex.org/wiki/C_Sharp/Break_and_Continue
The continue statement jumps over the following code within a loop. In other words it skips the proceeding code in the loop and continues to the next iteration in the loop. It does not exit the loop like the break will. Just like the break to work properly the continue statement needs an if condition to let the program know that if a certain condition is true the continue statement must be executed.
When the continue and break statements are used together it can greatly increase program performance within the loop structure. In the program example below there is an algorithm that will count from 1 to 10. The program will skip the fifth iteration to prove that the continue statement actually works.
کد:
using System;
class Program
{
static void Main(string[] args)
{
for(int count = 1; count <= 10; count++)
{
if (count == 5)
continue; //condition is met
//skip the code below
Console.WriteLine(count);
}
Console.Read();
}
}
نتیجه اجرا: در سایت نزده بود ولی بدون تست با کامپایلر و با نگاه به کدها فکر کنم 5 چاپ نشود و تا 10 چاپ شود.
==============================
The break statement alters the flow of a loop. It immediately exits the loop based upon a certain condition. After the loop is exited it continue to the next block of instructions. Exiting a loop early can boost program performance, it avoids unnecessary loops.
Lets take a look at some real code. The code is suppose to loop ten times but will exit prematurely and only loop five times.
As you can see when the if condition is evaluated to true the break statement is executed. The for loop is prematurely exited immediately and it does not execute any other code in the loop. The break statement also works for while, do/while, and switch statements.
کد:
using System;
class Program
{
static void Main(string[] args)
{
for(int count = 1; count <= 10; count++)
{
if (count >= 6)
break; //if condition is met
//exit the loop
Console.WriteLine(count);
}
Console.Read();
}
}
نتیجه اجرا: