В конверторе валют при вводе неверных символов ломается условие

decimal usdAmount;
decimal eurAmount;
decimal usdExchange;
decimal eurExchange;
while (true)    
{
    Console.WriteLine("\n\tChoose your currency:(UDS/EUR)\n");
    string currencyInput = Console.ReadLine();               
    if (currencyInput == "usd")
    {
        Console.WriteLine("\n\tChoose your operation:(Buy/Sell)\n");
        string operationInput = Console.ReadLine();
        if (operationInput == "buy")
        {
            Console.WriteLine("Please, Enter amount in USD:\n");
            var usdAmountInput = Console.ReadLine();
            var usdAmountValid = decimal.TryParse(usdAmountInput, out usdAmount);
            usdExchange = usdAmount * usdBuy;
            Console.WriteLine($"\n\tYou will get {Math.Round(usdExchange, 2)} KGS");
        }

        else if (operationInput == "sell")
        {
            Console.WriteLine("Please, Enter amount in USD:\n");
            var usdAmountInput = Console.ReadLine();
            var usdAmountValid = decimal.TryParse(usdAmountInput, out usdAmount);
            usdExchange = usdAmount * usdSale;
            Console.WriteLine($"\n\tYou will get {Math.Round(usdExchange,2)} KGS");
        }
    }

Ответы (0 шт):