The goto statement is a jump statement that controls the execution of the program to another segment of the same program. You create GetReStart at anywhere in program then can pass the execution control via the goto statements.
using System;
namespace goto_statement
{
class Program
{
static void Main(string[] args)
{
string ClassName;
GetReStart: //creating GetStart with colon(:)
Console.WriteLine("Enter Class Name:");
ClassName = Console.ReadLine();
Console.WriteLine("I am a final year {0} student ", ClassName);
goto GetReStart; //jump to GetReStart statement
}
}
}
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
The goto statement is a jump statement that controls the execution of the program to another segment of the same program. You create GetReStart at anywhere in program then can pass the execution control via the goto statements.