Advertisement
Rodunskiy

Untitled

Apr 9th, 2023
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. string userInput;
  2. string cycleEnd = "exit";
  3. bool repetitions = true;
  4.  
  5.  
  6. while (repetitions)
  7. {
  8.     Console.Write($"Для выхода из цикла введите - {cycleEnd}\nВведите сообщение: ");
  9.     userInput = Console.ReadLine();
  10.     Console.WriteLine(userInput);
  11.     Console.Clear();
  12.  
  13.     if (userInput == cycleEnd)
  14.     {
  15.         repetitions = false;
  16.         Console.WriteLine("Выход из цикла.");
  17.     }
  18. }
  19. Console.WriteLine("Нажмите любую кнопку для продолжения");
  20. Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement