This logic is a key example of when to use a Do-While; you must have at least one execution performed.
Your current design requires you to support two of the same logic lines if any change is needed.
For my reference:
private static int symbolChosen()
{
Console.WriteLine(" What symbol would you like to use press 8 for 'X' or 9 for 'O'.");
validInfo = Console.ReadLine();
isInRange = int.TryParse(validInfo, out playerInput);
while (!isInRange || playerInput <= 7 || playerInput >= 10)
{
Console.Clear();
welcomeSign();
playerInput = 0;
Console.WriteLine(" Invalid entry! ");
Console.WriteLine(" What symbol would you like to use press 8 for 'X' or 9 for 'O'.");
validInfo = Console.ReadLine();
isInRange = int.TryParse(validInfo, out playerInput);
}
return playerInput;
}
This logic is a key example of when to use a Do-While; you must have at least one execution performed.
Your current design requires you to support two of the same logic lines if any change is needed.
For my reference: