Kotlin Shipping calculator task
Hi everyone! Could please someone explain to me why the hell it is constantly demanding to "initialize "total" variable"? fun shippingCost(amount: Double, international: Boolean, total: Double): Double { var total: Double if (international == true) { if ((amount * 0.15) > 50.0) { return (total) } else { total = amount * 0.15 } return (total) } else if (international == false) { if (amount < 75.0) { total = amount * 0.10 } else { total = 0.0 } } return (total) } fun main(args: Array<String>) { var amount = 140.0 val total = readLine()!!.toDouble() val international = readLine()!!.toBoolean() println(shippingCost(total, international)) }