s

C# continue statement edit button Edit

author
Rakesh Kumar Sutar | calendar 14 January 2021 | 1868

Introduction

The continue statement passes control to the next iteration of the enclosing while, do, for, or foreach statement in which it appears.

Example

Using the continue statement with the expression (i < 9), the statements between continue and the end of the for body are skipped in the iterations where i is less than 9. In the last two iterations of the for loop (where i == 9 and i == 10), the continue statement is not executed and the value of i is printed to the console.


using System; namespace Hello_world { class Program { static void Main(string[] args) { for (int i = 1; i <= 10; i ) { if (i < 9) { continue; } Console.WriteLine(" " i); } } } }

Output