Posts

Showing posts with the label C# Statements

C# Break ,Continue and Goto Statements

  C# Break The  break  statement can also be used to jump out of a  loop . This example jumps out of the loop when  i  is equal to  5 : // Online C# Editor for free // Write, Edit and Run your C# code using C# Online Compiler using System; for (int i = 0; i < 10; i++)  {   if (i == 5)    {     break;   }   Console.WriteLine(i); } Output : 0 1 2 3 4 C# Continue The  continue  statement breaks one iteration (in the loop), if a specified condition occurs, and continues with the next iteration in the loop. This example skips the value of  6 : for (int i = 0; i < 10; i++)  {   if (i == 6)    {     continue;   }   Console.WriteLine(i); } Output 0 1 2 3 4 5 7 8 9 C# goto(Jump Statement) The goto is C#  unconditional jump statement. When encountered, program flow jumps to the location specified by the goto. It can be used to transfer control from deeply ne...