I know using goto is something most people say to avoid, however I have read on various places that sometimes it is useful if you need simple code. Currently I have very simple program that needs to be repeated if user selects so:
static void Main()
{
Restart:
...
string UserChoice=Console.ReadLine();
if (UserChoice=="y")
goto Restart;
}
Is using goto here really so bad? I just cannot see any other way how to repeat the code without doing loops etc. This seems to be very straightforward and clean way. Or am I missing something?
string userchoice;
do {
userchoice=Console.ReadLine();
} while (userchoice=="y");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With