Function returns finish value.

Function of function's returning object returns finish value. Вот результат.
 avatar
Pablo
kotlin
2 years ago
912 B
1
Indexable
Never
object Converters {
    private val converters = listOf(Dollars(), Euro(), UkrainianHryvnia())
    fun get(currencyCode: String):CurrencyConverter {
       val findConverter =  converters.find {it.currencyCode == currencyCode}
        return findConverter?: object : CurrencyConverter {
                override val currencyCode: String = currencyCode
                override fun convertToRub(code: Double): Double {
                    println("Такой валютыв в нашем конвертре нет")
                    println("Введите стоимости")
                    val exchanger = readLine()!!.toDoubleOrNull()
                        exchanger?: return println("Введено не кооректное значение")
                    val sett = exchanger * code
                        println("$code Рублей - $sett")
                        return sett.toDouble