NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

1.7.2 Labeled statements and goto statements

A labeled statement permits a statement to be prefixed by a label, and goto statements can be used to transfer control to a labeled statement.

The example

using System;
class Test
{
   static void Main() {
      goto H;
      W: Console.WriteLine("world");
      return;      
      H: Console.Write("Hello, ");
      goto W;
   }
}

is a convoluted version of the "Hello, world" program. The first statement transfers control to the statement labeled H. The first part of the message is written and then the next statement transfers control to the statement labeled W. The rest of the message is written, and the method returns.