Do / while loop with a console read : Do While : Statement C# Examples


C# Examples » Statement » Do While »

 

Do / while loop with a console read









    
using  System;
using  System.IO;

class  MainClass
{
    public  static  void  Main(string[]  args)
    {
        string  ans;
        do
        {
            Console.Write("Are  you  done?  [yes]  [no]  :  ");
            ans  =  Console.ReadLine();
        }while(ans  !=  "yes");
    }
}
    
   
  
   



Output

Are you done? [yes] [no] : yes


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Statement
» Do While