我正在学习C#atm并且我不知道如何执行以下操作:
while (points > 0)
{
String input = Convert.ToString(Console.ReadLine());
if (input != true)
{
Console.WriteLine("wrong number!");
// here it should stop the following code and start again at the beginning at the while-loop.
}
// code if number is correct
喜欢"停止;",感谢您的帮助!
答案 0 :(得分:0)
continue
是您要查找的关键字。进一步阅读:
答案 1 :(得分:0)
使用continue
关键字来实现此目标: -
while (points > 0)
{
string input = Convert.ToString(Console.ReadLine());
if (string.IsNullOrEmpty(input))
{
Console.WriteLine("wrong number!");
continue;
}
}