C# Continue Statement

In this chapter you will learn:
  • What is Continue statement in C#?
  • What is the benefit of using continue statement in C# programming?
  • How to use Continue statement in program?

The continue statements enable you to skip the loop and jump the loop to next iteration.

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace continue_statements
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 0;
            while (i < 10)
            {
                i++;
                if (i < 6)
                {
                    continue;
                }
                Console.WriteLine(i);
            }
            Console.ReadLine();
        }
    }
}

 

In this program, skips the loop until the current value of i reaches 6. Output is given below.

Output

6
7
8
9
10
__

Summary

In this chapter you learned about continue statement in C#. In next chapter you will learn return statement in C#.

More Articles

 

Share your thought



PLEASE DISABLE ADBLOCKER AND SUPPORT US!

Please support us by enabling ads on this page. Refresh

YOU DON'T LIKE ADS, WE ALSO DON'T LIKE ADS!
 
But we have to show ads on our site to keep it free and updated. We have to pay huge server costs, domain costs, CDN Costs, Developer Costs, Electricity and Internet Bill. Your little contribution will encourage us to regularly update this site.