The break command can be used to exit a loop at any time. In the example code below, the for loop will exit when the value of i is equal to 5. The program will print "I like C# programming language." five times and then the loop will exit.
for (i = 1; i <= 10; i++)
Console.WriteLine("I like C# programming language.");
The continue command lets the program start the next iteration of the loop. See the example code below. The while loop continues if i is smaller than or equal to 5.
while(i <= 5)
Console.WriteLine("I like C# programming lanuage.");
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: