I'm brand spanking new and apologize if the title doesn't even make sense. I've been pretty good at finding answers on here from what other people have asked, but I'm not sure about this one. If the user inputs anything other than the answer for an if statement (else) it gives the right response, but then any other key after that just closes the console. I'm making a "choose your own adventure" for my very first project and I am able to get the right responses when the user inputs an answer, but for the "else" statement, it gives the right response, but then if I hit any other key, it closes the whole console.
I'm making a "choose your own adventure" for my very first project and I am able to get the right responses when the user inputs an answer, but for the "else" statement, it gives the right response, but then if I hit any other key, it closes the whole console.
//Prompt user for a choice
Console.WriteLine("What Do You Say?");
Console.WriteLine("1=\"What's wrong\" \n2=\"I have to get to school\"");
Console.WriteLine("> ");
string helpGirl = Console.ReadLine();
//User Helped the Girl
if (helpGirl == "1")
{
Console.WriteLine("You ask the girl what's wrong, she slowly looks up at you...");
Console.ReadKey(true);
Console.WriteLine("The girl slowly turns and points to the house, saying \"I left my bracelet inside that house, can you please grab it\"");
}
//User kept going to school
else if (helpGirl == "2")
{
Console.WriteLine("You Die!");
}
else
{
Console.WriteLine("Please Choose 1 or 2");
}
Console.ReadKey();
}
I'm assuming this is because its just going to the next line of ReadKey instead of reverting back to the if statement? Thanks in advance.