C# Continue Statement

Whenever the program control finds the C# Continue statement, it skips the remaining statements in the code and sets the pointer to the beginning of the loop for the next iteration.

Continue Syntax 1

C# Continue Statement Example

Let us see the example.

using System;
 
 public class Program
 {
   static void Main()
   {
     for (int i = 1; i <= 6; i++)
     {
       if (i <= 3)
       {
         continue;
       }
       Console.WriteLine(i);
     }
     Console.WriteLine("Control is out of loop");
     Console.Read();
   }
 }
C# Continue Statement 2

The difference between the C# break and continue statement

The break allows the control to come out of the loop from execution. Whereas the continue statement skips only the current iteration and continues with the next iteration in the C Sharp loop.

Categories C#