Do While Iteration Statements - CSharp Language Basics

CSharp examples for Language Basics:do while

Description

Do While Iteration Statements

Demo Code

using System;//from w  w w. j  a v  a 2 s.  co m
using static System.Console;
class Program
{
   static void Main(string[] args)
   {
      string password = string.Empty;
      do
      {
         Write("Enter your password: ");
         password = ReadLine();
      } while (password != "secret");
      WriteLine("Correct!");
   }
}

Result


Related Tutorials