I want to go back to the "Console.Write(num1), if use input the wrong value. how to code? Pls help!
using System; namespace ConsoleApp1 { class Program { static void Main(string[] args) { do { Console.Write("num1 : "); string str = Console.ReadLine(); if (str == "exit") break; int num1; try { num1 = Convert.ToInt32(str); } // I want to go back to start after catch {}, how to do. catch { Console.WriteLine("You are keying in the wrong value, Please Try Again"); num1 = 0; } Console.Write("num2 :"); int mum2 = Convert.ToInt32(Console.ReadLine()); //sum of num1 and mum2 int sum = num1 + mum2; Console.WriteLine("Result: {0}" ,sum); Console.WriteLine("\nThat is amazing"); Console.Read(); } while (true); } } }