Dheerapat
01/17/2023, 11:13 AMfun main() {
val cup = 25
println(cup + " cup of water")
}
However this snippet of code face a compile error and the way to work around this is as follow:
fun main() {
val cup = 25
println("" + cup + " cup of water")
}
I dont't know that in Java/Kotlin world this is normal or not but I think it's a little weird and can be improved to make a developer experience better (I come from JS field)Joffrey
01/17/2023, 11:17 AMInt.plus
and passing a string to this function is not allowed. I would suggest using string templates instead:
val cup = 25
println("$cup cups of water")
CLOVIS
01/17/2023, 11:17 AMDheerapat
01/17/2023, 11:25 AMRasheed
01/18/2023, 6:24 AMJoffrey
01/18/2023, 8:53 AM