SaNik74

exit control

Jan 22nd, 2024
1,333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. class Program
  2. {
  3.     static void Main(string[] args)
  4.     {
  5.         const string ExitCommand = "exit";
  6.         bool isWorking = true;
  7.         string userInput;
  8.  
  9.         Console.WriteLine($"Введите {ExitCommand} для выхода из программы.");
  10.  
  11.         while (isWorking)
  12.         {
  13.             userInput = Console.ReadLine();
  14.  
  15.             if (userInput == ExitCommand)
  16.             {
  17.                 isWorking = false;
  18.             }
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment