Skip to content

Instantly share code, notes, and snippets.

@QRemark
Created January 10, 2024 10:07
Show Gist options
  • Save QRemark/3b07ccf904f4e07472d37149b45d17f0 to your computer and use it in GitHub Desktop.
Save QRemark/3b07ccf904f4e07472d37149b45d17f0 to your computer and use it in GitHub Desktop.
Контроль выхода
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace homeWork2
{
internal class Program
{
static void Main(string[] args)
{
string userInput;
Console.Write("Здравствуйте! Введите пожалуйста слово exit, " +
"иначе цикл не завершиться: ");
userInput = Console.ReadLine();
while (userInput != "exit")
{
Console.WriteLine($"Ваше слово {userInput}. Пожалуйста, введите " +
"слово exit, иначе цикл не завершиться: ");
userInput = Console.ReadLine();
}
Console.WriteLine( "Вы ввели слово exit, спасибо! ");
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment