C
C#13mo ago
Liu

❔ 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();
2 Replies
JakenVeina
JakenVeina13mo ago
Branches and loops - Introduction to C# tutorial
In this tutorial about branches and loops, you write C# code to explore the language syntax that supports conditional branches and loops to execute statements repeatedly.
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.