© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
2 replies
Liunesca

❔ How do I make it so when the player makes an incorrect key input, it lets them make another input

if (keyInfo.Key == ConsoleKey.D1)
{
Console.WriteLine("This is a test!");
}

else if (keyInfo.Key == ConsoleKey.D2)
{
Console.WriteLine("This is also a test!");
}

else if (keyInfo.Key == ConsoleKey.D3)
{
Console.WriteLine();
}

else if (keyInfo.Key == ConsoleKey.D4)
{
Console.WriteLine();
}

else
{
Console.WriteLine("Please press the correct key.");
}

Console.ReadLine();
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ How can I make it so an array saves changes when I turn off the program
C#CC# / help
3y ago
how do i make it so when i press it this happens and if i do it again another thing happens
C#CC# / help
3y ago
❔ How do i make user input text appear
C#CC# / help
3y ago
❔ How do I take textbox input and make an object out of it, then add it to an array?
C#CC# / help
3y ago