CSharp examples for Language Basics:goto
Using the goto Statement with a Label
class MainClass//from w w w.j av a2 s . co m { public static void Main() { int score = 0; int i = 0; System.Random rnd = new System.Random(); Start: i++; if (i > 10) goto EndThis; else score = (int) rnd.Next(60,101); System.Console.WriteLine("{0} - You received a score of {1}", i, score); goto Start; EndThis: System.Console.WriteLine("Done with scores!"); } }