Terminate a control input
using System; public class MainClass { static void Main() { string resp; Console.WriteLine("Enter command ('x' to end):"); while ((resp = (Console.ReadLine()).ToLower()) != "x") { switch (resp) { case "a": Console.WriteLine("Doing Task A"); break; case "b": Console.WriteLine("Doing Task B"); break; default: Console.WriteLine("Bad choice"); break; } } } }