C# goto Keyword

C# Code Snippets goto Keyword


In this code snippet, we will take a look at the goto keyword in C#.

goto is used to move the control of your program to a label you define beforehand. This can be useful to get out of nested loopsif statements or any nested code blocks in general.

You can even make a DIY loop or method using the goto keyword 😁(But you should of course use the regular loops and methods).

Let’s have a look at the code below to see how to use goto.


Resulting output:


Leave a Reply

Your email address will not be published.

The following GDPR rules must be read and accepted:
This form collects your name, email and content so that we can keep track of the comments placed on the website. For more info check our privacy policy where you will get more info on where, how and why we store your data.

Advertisment ad adsense adlogger