Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string userInput;
- while (true)
- {
- Console.WriteLine("Välkommen till menyn");
- Console.WriteLine("Vill du avsluta programmet? Skriv ja/nej");
- // användaren matar in ett svar
- userInput = Console.ReadLine();
- if (userInput == "ja")
- {
- // Sätt condition till false vilket inte kommer göra avsluta loopen.
- Console.WriteLine("Programmet avslutas...");
- break;
- }
- else if (userInput == "nej")
- {
- Console.WriteLine("Återvänder till menyn");
- }
- else
- {
- Console.WriteLine("Ogiltig inmatning");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement