![](/img/trans.png)
[英]How do i make a button that inserts A Certain text into a textbox in Visual Studio C#?
[英]How do I make an if statement goto a point when a certain input is entered? Microsoft Visual Studio C#
我在C#中使用Microsoft Visual Studio 2010。 我編寫了一個程序,詢問了一系列問題,最后,它詢問是否有任何錯誤。 我如何才能做到這一點,以便如果用戶輸入“否”,它會在一定程度上“轉到”? 這是我到目前為止所擁有的。
Console.WriteLine("Is This Correct? Yes/No");
var response = Console.ReadLine();
if (response = No)
goto Loop;
由於這不起作用,將不勝感激任何幫助。 提前致謝。
string Response = "No";
while (Response != "Yes")
{
Console.WriteLine("Loop");
Console.WriteLine("Is This Correct? Yes/No");
Response = Console.ReadLine();
}
您的if
陳述不正確。 No
應該是一個字符串。 嘗試這個:
if (response == "No")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.