[edit] The C# goto Statement
goto statements are used with C# labels. Do not overuse goto statements as they can quickly make any C# program very difficult to debug. Take a look at the following code:
using System; class Test { static void Main() { int a; goto label1; a = 1000; //This line will never execute label1: a = 100; Console.WriteLine(a); Console.Read(); } }
Output
As you can see line 9 will never execute. The goto statements are often used with if or switch blocks. If these statement or not used with goto there will always be certain parts of code that will never execute.
|