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#.
In this chapter you will learn: