Labels

Labels are program elements that simply identify a location in a program. Their only practical use is to support the goto statement. The goto statement allows program control to jump to the place where a label is defined. A label is any valid identifier followed by a colon (not a semicolon). Here are two examples:

loop:        // a label named "loop"

jumphere:    // a label named "jumphere"

Get C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.