Methods in C#
/*Please help me to ask the user to input only "yes or no" If they fail to do so, it will ask them again. The condition where i want to loop is the the *default* part of the switch case. meaning if they don't input "yes or no" it will output: Choose either 'yes' or 'no' :-( // here they will input again if false Choose either 'yes' or 'no' :-( // and so on .................... if true then cases will be executed. */ string choice, retry; Console.WriteLine("**THIS MIGHT DAMAGE YOUR PC**\nWould you like continue:\"yes or no\""); choice = Console.ReadLine(); switch (choice) { case "yes": // this is below line is a method. form(); break; case "no": Console.WriteLine("\nThank You :-)"); break; default: Console.WriteLine("\nChoose either 'yes' or 'no' :-("); retry = Console.ReadLine(); break; }