public static void _main()
 {
     WriteLine("Enter a currency pair like 'EURUSD', or 'q' to quit");
     for (string input; (input = ReadLine().ToUpper()) != "Q";)
     {
         WriteLine(FxApi.GetRate(input));
     }
 }
        static (decimal, Rates) GetRate(string ccyPair, Rates cache)
        {
            if (cache.ContainsKey(ccyPair))
            {
                return(cache[ccyPair], cache);
            }

            var rate = FxApi.GetRate(ccyPair);

            return(rate, cache.Add(ccyPair, rate));
        }
        static void MainRec(string message, Rates cache)
        {
            WriteLine(message);
            var input = ReadLine().ToUpper();

            if (input == "Q")
            {
                return;
            }

            GetRate(pair => () => FxApi.GetRate(pair), input, cache).Run().Match(
                ex => MainRec($"Error: {ex.Message}", cache),
                result => MainRec(result.Quote.ToString(), result.NewState));
        }