Mega Code Archive

 
Categories / C# / Language Basics
 

The continue statement

/* Mastering Visual C# .NET by Jason Price, Mike Gunderloy Publisher: Sybex; ISBN: 0782129110 */ /*   Example4_14.cs illustrates the use of   the continue statement */ public class Example4_14 {   public static void Main()   {     int total = 0;     for (int counter = 1; counter <= 10; counter++)     {       if (counter == 6)       {         System.Console.WriteLine("continue from loop start");         continue;       }       System.Console.WriteLine("counter = " + counter);       total += counter;     }     System.Console.WriteLine("total = " + total);   } }