I’m familiar with loops, yet looping a process has left me bewildered:
If the user enters a non-integer, I would like the question ‘your age’ to be prompted again until the user enters an integer.
Console.WriteLine("Your age:");
string line = Console.ReadLine();
if (!int.TryParse(line, out age))
{
Console.WriteLine("{0} is not an integer", line);
}
Try this, it will make “Your age: “ repeat until you have correct input: