Friday, 1 September 2017

How to Use Continue Statements in C# With Example

How to Use Continue Statements in C# With Example

Syntax:

    jump-statement;   
    continue;  

    C# Continue Statement Example
   

     using System; 
        public class ContinueExample 
            { 
              public static void Main(string[] args) 
              { 
                 for(int i=1;i<=10;i++){   
                    if(i==5){   
                        continue;   
                    }   
                    Console.WriteLine(i);   
                }   
              } 
           } 

        C# Continue Statement with Inner Loop
       

           using System; 
            public class ContinueExample 
                { 
                  public static void Main(string[] args) 
                  { 
                      for(int i=1;i<=3;i++){     
                                for(int j=1;j<=3;j++){     
                                    if(i==2&&j==2){     
                                        continue;     
                                    }     
                                    Console.WriteLine(i+" "+j);     
                                }     
                        }     
                  } 
               }

Post a Comment

Whatsapp Button works on Mobile Device only

Start typing and press Enter to search