Demonstrate the goto. : Goto : Statement C# Examples


C# Examples » Statement » Goto »

 

Demonstrate the goto.









    
using  System;    
    
class  MainClass  {          
    public  static  void  Main()  {          
        for(int  i=0;  i  <  10;  i++)  {  
            Console.WriteLine("i"  +  i);  
            if(i  ==  3)  
                    goto  stop;  
        }  
stop:  
        Console.WriteLine("Stopped!");  
        
    }    
}
    
   
  
   



Output

i0
i1
i2
i3
Stopped!


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Statement
» Goto