private static void SecondVal(Calculator calc) { Console.Write("Enter another number: "); string s = Console.ReadLine(); if (calc.ParseInt(s)) { calc.y = Convert.ToInt32(s); Calculation(calc); } else // Go back 1 step { Console.WriteLine("Not a number."); SecondVal(calc); } }
private static void InitCalculator(Calculator calc) { Console.Write("Enter a number: "); string s = Console.ReadLine(); if (calc.ParseInt(s)) { calc.x = Convert.ToInt32(s); SecondVal(calc); } else // Go back 1 step { Console.WriteLine("Not a number."); string[] args = new string[0]; Main(args); } }