Created
August 28, 2021 15:10
-
-
Save csharpforevermore/03a3418f0d8045bb5a96926fce56bcf0 to your computer and use it in GitHub Desktop.
User input for an integer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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