I want to ask the user yes or no again when they type "idk" until they reply yes or no, how to rerun the ask
and ans
above? I don't want to use booleans.
static void Main(string[] args) { string ask = "Yes or No?"; Console.WriteLine(ask); string ans = Console.ReadLine(); switch(ans) { case "yes": yes(); break; case "no": no(); break; case "idk": //run "ask" again } }
https://stackoverflow.com/questions/66864268/how-to-rerun-a-code-again-in-switch-statement-c-beginner March 30, 2021 at 11:06AM
没有评论:
发表评论