Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- while(true)
- {
- Console.Write("Choose an option (1, 2, 3)? ");
- var option = Console.ReadLine();
- switch (option)
- {
- case "1":
- case "2":
- Console.WriteLine("You did not win :(");
- break;
- case "3":
- Console.WriteLine("You won!");
- break;
- default:
- Console.WriteLine("This is not an option.");
- break;
- }
- Console.Write("Type quit to exit or press ENTER to continue...");
- var input = Console.ReadLine();
- // Make it all uppercase so we don't have to guess what the user typed in.
- // We just care about the word.
- if (input.ToUpper() == "QUIT")
- {
- // Break out of the loop which will end the app
- break;
- }
- // Clear the console of the previous inputs for a clean start
- Console.Clear();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement