Demonstrate the goto : Goto : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » Goto »

 

Demonstrate the goto









    

/*
C#: The Complete Reference 
by Herbert Schildt 

Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/
// Demonstrate the goto. 
  
using System;  
  
public class Use_goto {     
  public static void Main() {     
    int i=0, j=0, k=0; 
 
    for(i=0; i < 10; i++) { 
      for(j=0; j < 10; j++ ) { 
        for(k=0; k < 10; k++) { 
          Console.WriteLine("i, j, k: " + i + " " + j + " " + k); 
          if(k == 3) goto stop; 
        } 
      } 
    } 
 
stop: 
    Console.WriteLine("Stopped! i, j, k: " + i + ", " + j + " " + k); 
    
  }  
}


           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» Goto