Vitaliy Zarubin
05/13/2021, 10:37 AMiamthevoid
05/13/2021, 10:44 AMrtsketo
05/13/2021, 10:59 AMinfix fun Int.div(n :Int): Int = this + n
And let the anarchy begin π¦Roukanken
05/13/2021, 11:55 AMdarkmoon_uk
05/13/2021, 12:15 PMVitaliy Zarubin
05/13/2021, 1:41 PMByron Katz
05/13/2021, 4:35 PMVitaliy Zarubin
05/13/2021, 6:07 PMByron Katz
05/13/2021, 6:18 PMVitaliy Zarubin
05/13/2021, 6:23 PMRoukanken
05/13/2021, 6:36 PMinvoke
will be indistinguishable by usage, but it's definition will definitely be clearer on what it's doing
you shown b) there, even if not with invoke
and by lambdas you can simply do:
fun countTax(price: Double, taxRate: Double): Double = price * taxRate + price
val countMyCountryTax = { price: Double -> countTax(price, 0.2) }
countMyCountryTax(100.0)
which makes it clear what exactly countMyCountryTax
function does by looking at it and can be used as value
you could even just define it by fun
and it would be clearVitaliy Zarubin
05/13/2021, 6:48 PMVitaliy Zarubin
05/14/2021, 12:05 PMMatteo Mirk
05/17/2021, 7:36 AM