Please see my code below.
Console.WriteLine("Enter a number between 1 and 5");
string _numberInt = Console.ReadLine();
Convert.ToInt32(_numberInt);
if (_numberInt != "1, 5")
{
throw new System.ArgumentException("Please use a number between 1-5.");
}
I am trying to make the code so that if the user doesn't input a number between 1 and 5, it will throw an exception. I then want it to go back and ask the question again until it is correct.
At this current instance, it will simply skip past this and the console will close, while also ignoring the rest of my code. Please could someone help me understand what i need to do here?
Before anyone suggests anything, I've not been coding long, and i am trying to learn as much as possible. Please leave constructive advice.