CSharp examples for Language Basics:continue
continue statement skipping an iteration of a for statement.
using System;//from w ww .jav a2s .c o m class ContinueTest { static void Main() { for (int count = 1; count <= 10; ++count) // loop 10 times { if (count == 5) // if count is 5, { continue; // skip remaining code in loop } Console.Write($"{count} "); } Console.WriteLine("\nUsed continue to skip displaying 5"); } }