if (response.ToLower() == "addition")
{
Console.Write("Enter a number: ");
double num1 = double.Parse(Console.ReadLine());
Console.Write("Enter another number: ");
double num2 = double.Parse(Console.ReadLine());
double addition = (num1) + (num2);
Console.WriteLine("The answer is {0}", addition);
if(!double.TryParse (num1, out addition))
{
Console.WriteLine("Try Again");
tryAgain = true;
}
I tried to use try parse to handle my unhandled exception and make the user go back and do it again if they dont input a number/ integer/ decimal. I am new to try parse and dont know how to use it properly, So i would like to ask for a way in which i could handle exceptions in the future as well
Here's an inline link to replit(https://replit.com/@NitikPaudel/Maths-Calculator-Upgraded#main.cs)