.NET Array Dictionary List String 2D Async DataTable Dates DateTime Enum File For Foreach Format IEnumerable If IndexOf Lambda Parse Path Process Property Regex Replace Row Sort Split Static StringBuilder Substring Switch Tuple Window

**And:** If the number is evenly divisible, the rest of the iteration is aborted. The loop restarts.

C# program that uses continue keywordusing System; using System.Threading; class Program { static void Main() { Random random = new Random(); while (true) {// Get a random number.int value = random.Next();// If number is divisible by two, skip the rest of the iteration.if ((value % 2) == 0) {continue; }// If number is divisible by three, skip the rest of the iteration.if ((value % 3) == 0) {continue; } Console.WriteLine("Not divisible by 2 or 3: {0}", value);// Pause.Thread.Sleep(100); } } }OutputNot divisible by 2 or 3: 710081881 Not divisible by 2 or 3: 1155441983 Not divisible by 2 or 3: 1558706543 Not divisible by 2 or 3: 1531461115 Not divisible by 2 or 3: 64503937 Not divisible by 2 or 3: 498668099 Not divisible by 2 or 3: 85365569 Not divisible by 2 or 3: 184007165 Not divisible by 2 or 3: 1759735855 Not divisible by 2 or 3: 1927432795 Not divisible by 2 or 3: 648758581 Not divisible by 2 or 3: 1131091151 Not divisible by 2 or 3: 1931772589 Not divisible by 2 or 3: 283344547 Not divisible by 2 or 3: 1727688571 Not divisible by 2 or 3: 64235879 Not divisible by 2 or 3: 818135261...

**Note:** The continue statement could be implemented by branching to the top of the loop construct if the result of the expression is true.

**So:** Continue is often most useful in while or do-while loops. For-loops, with well-defined exit conditions, may not benefit as much.