I am using Microsoft Visual Studio 2010 in C#. I have made a program that asks a series of questions, at the end, it asks if there is any mistakes. How can i make it so that if the user enters "No", it does "goto" to a certain point? this what i have so far.
Console.WriteLine("Is This Correct? Yes/No");
var response = Console.ReadLine();
if (response = No)
goto Loop;
As this does not work, Any help would be greatly appreciated. Thanks in advance.
string Response = "No";
while (Response != "Yes")
{
Console.WriteLine("Loop");
Console.WriteLine("Is This Correct? Yes/No");
Response = Console.ReadLine();
}
Your if
statement is incorrect. No
shoud be a string. Try this:
if (response == "No")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.