Methods in C#
/*THIS IS ME LEARNING METHODS IN C# PLEASE HELP ME TO REPEAT THE METHOD TO ASK THE USER "YES OR NO" EVERY TIME. IF IT DOES NOT MATCH "yes || no" the problem where i am facing is marked between ******************************** problem ******************************** */ 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) { alert(); void alert() { Console.WriteLine("**This might damage your PC**\nDo you want to continue: yes or no"); var choice = Console.ReadLine(); if (choice == "yes") { form(); } else if (choice == "no") { Console.WriteLine("Thank You:-)"); } else { ********************************************************************* while (choice != "yes" || choice == "no") Console.WriteLine(":-{ Choose a correct option"); Console.ReadLine(); break; ********************************************************************* } } void form() { Console.WriteLine("Hello welcome to the page!"); } // this readline is used like a getch() statement in C# for me it will hold the screen as soon as the code is finished. Console.ReadLine(); } } }