I have the following error:
Not all code paths return a value in lambda expression of type.
I can't resolve it.
delegate bool BoolPassword(string s1, string s2);
delegate bool Captha(string s1, string s2);
static void Main(string[] args)
{
Console.Write("Enter password ");
string password1 = Console.ReadLine();
Console.Write("Repeat password ");
string password2 = Console.ReadLine();
BoolPassword bp = (s1, s2) => s1 == s2;
if (bp(password1, password2))
{
Random rand = new Random();
string resCaptha = "";
for (int i = 0; i < 10; i++)
resCaptha += (char)rand.Next(0, 100);
Console.WriteLine("Enter code " + resCaptha);
string resCode = Console.ReadLine();
Captha cp = (s1, s2) => // Error is here
{
if (s1 == s2)
Console.WriteLine("Ok");
else
Console.WriteLine("fail");
};
cp(resCaptha, resCode);
}
else
Console.WriteLine("Fail");
}