Skip to content

Instantly share code, notes, and snippets.

@csharpforevermore
Created August 28, 2021 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csharpforevermore/03a3418f0d8045bb5a96926fce56bcf0 to your computer and use it in GitHub Desktop.
Save csharpforevermore/03a3418f0d8045bb5a96926fce56bcf0 to your computer and use it in GitHub Desktop.
User input for an integer
int X;
String Result = Console.ReadLine();
while(!Int32.TryParse(Result, out X))
{
Console.WriteLine("Not a valid number, try again.");
Result = Console.ReadLine();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment