Continue keyword in C#.Net

In this post,we will learn about Continue keyword in C#.Net with an example.

Description:

In my previous posts I have explained various topics likeĀ Difference between string and StringBuilder in C#, Difference between a struct and a class in C#, Boxing & Unboxing in C# ,Dynamic Type In C#, Named Arguments In C#, Basics Of Pointers In C#, Get site visitor count in asp.net, Convert generic list to datatable in Asp.Net C#.Net, Abstract Class in C# with Example.





Now in this post, I will explain about how to get Continue keyword in C#.Net with appropriate example. By using continue statement, you can ‘jump over one iteration’ and then resume your loop execution.

Now create Console Application in Visual Studio and write below lines of code in it.

using System;  
using System.Collections;  
using System.Linq;  
using System.Text;  
  
namespace ConsoleDemp   
    {  
        Class Program {  
            public static void main(String[] args) {  
                for (int i = 0; i <= 5; i++) {  
                    if (i == 4) {  
                        break;  
                    }  
                    Console.WriteLine("The number is " + i);  
                    Console.ReadLine();
  
                }  
            }  
        }  
  
    } 

Output of above code is,

The number is 0;
The number is 1;
The number is 2;
The number is 3;

Summary

I hope you got an idea about Continue keyword in C#.Net.
I would like to have feedback from blog my readers.
Your valuable feedback, question, or comments about this article are always welcome.

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *
Email *
Website