Sininerebane

Untitled

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