Sininerebane

Untitled

Jun 15th, 2023
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | Software | 0 0
  1. namespace ConsoleAppWhileExit
  2. {
  3.     class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             Console.OutputEncoding = Encoding.UTF8;
  8.             bool isCycleContinue = true;
  9.             string userMessage;
  10.             string exitCycle = "exit";
  11.  
  12.             while (isCycleContinue)
  13.             {
  14.                 Console.WriteLine("Введите слово");
  15.  
  16.                 userMessage = Console.ReadLine();
  17.  
  18.                 if (userMessage != exitCycle)
  19.                 {
  20.                     Console.WriteLine("Ваш цикл продолжается");
  21.                 }
  22.                 else
  23.                 {
  24.                     isCycleContinue = false;
  25.                 }
  26.             }
  27.  
  28.             Console.WriteLine("Ваш цикл закончился! ");
  29.             Console.ReadKey();
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment