I really feel my lag of skills here. Got it to work this way. I tried many things to keep the code simple, but I didn’t get the syntax for &&. to work It get complex very easily.
void Password(string input) // select level
{
if (level == 1)
{
Level1Pass(input);
}
else if (level == 2)
{
Level2Pass(input);
}
}
void Level1Pass(string input) // level 1 passwords
{
if (input == "mypass1")
{
RunWin();
}
else
{
WrongPass();
}
}
void Level2Pass(string input) // level 2 passwords
{
if (input == "mypass2")
{
RunWin();
}
else
{
WrongPass();
}
}
void RunWin() // Won screen
{
Terminal.WriteLine("Wrong password! Try again.");
}
void WrongPass() // Won screen
{
Terminal.WriteLine("Congratulation password was hacked!");
}