• Introduction:

    In this article we will explain how to use continue statement in c# program or use continue statement in c# loop with example.

    Description:

    The C# continue statements enables you to skip the loop and jump the loop to next iteration. It continues the current flow of the program and skips the remaining code at specified condition. In case of inner loop, it continues only inner loop.

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 0;
            while (i <10)
            {
                Console.WriteLine(i);
                if (i == 5)
                {
                    Console.WriteLine("Breaking the current Statement...");
                    break;
                }
                i++;
            }
            Console.ReadLine();
        }
    }
}

Output:

1

2

3

4

5

Breaking the current Statement...

0 comments


Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

You may also like