CSharp - Write program to repeatedly verify a password until the user enters the correct one

Requirements

You will repeatedly ask the user to enter a password until the user enters the correct one.

Hint

To write the loop, you use the do-while construction.

Demo

using System;
class Program/*from  w w w.ja v a2s .  c om*/
{
    static void Main(string[] args)
    {
        string correctPassword = "friend";

        bool ok;
        do
        {
            Console.Write("Enter password: ");
            string enteredPassword = Console.ReadLine();

            // Evaluating 
            ok = enteredPassword == correctPassword;
        } while (!ok); // loop repeats when the condition holds 

        Console.WriteLine("Come inside, please...");
    }
}

Result