Function returns finish value.

Function of function's returning object returns finish value. Вот результат.
 avatar
Pablo
kotlin
3 years ago
811 B
1
Indexable
interface CurrencyConverter {
    val currencyCode: String;
    fun convertToRub(code: Double): Double;
}

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
Editor is loading...