Sininerebane

Untitled

Sep 8th, 2023
1,319
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 exitWord = "exit";
  11.  
  12.             while (isCycleContinue)
  13.             {
  14.                 Console.WriteLine("Введите слово");
  15.                 userMessage = Console.ReadLine();
  16.  
  17.                 if (userMessage != exitWord)
  18.                 {
  19.                     Console.WriteLine("Ваш цикл продолжается");
  20.                 }
  21.                 else
  22.                 {
  23.                     isCycleContinue = false;
  24.                 }
  25.             }
  26.  
  27.             Console.WriteLine("Ваш цикл закончился! ");
  28.             Console.ReadKey();
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment