C# Programming/Keywords/goto
Appearance
From Wikibooks, open books for an open world
The latest reviewed version was checked on 16 April 2020. There are template/file changes awaiting review.
C# Programming
Cover | Introduction | Basics | Classes | Advanced Topics | The .NET Framework | Index
Cover | Introduction | Basics | Classes | Advanced Topics | The .NET Framework | Index
The goto
keyword returns the flow of operation to the label which follows it. Labels can be created by putting a colon after any word. e.g.
thelabel:// This is a label System.Console.WriteLine("Blah blah blah"); gotothelabel;// Program flow returns to thelabel
The use of goto is very controversial, because, when used frivolously, it creates code that jumps from place to place and is disorganized and hard to read. It is rarely even necessary because the same thing can often be accomplished with a more organized for
loop or while
loop.
C# Keywords |
---|
Special C# Identifiers (Contextual Keywords) |
Contextual Keywords (Used in Queries) |