Peter Mandeljc
03/31/2022, 7:59 AM// A
fun example() = "banana"
// B
companion object {
const val X = "banana"
}
fun example() = X
I guess benefit is storing variable to heap. But on the other hand, I think that adding single-use constants impacts code readability. Any thoughts?Fleshgrinder
03/31/2022, 8:02 AMephemient
03/31/2022, 8:02 AMephemient
03/31/2022, 8:06 AMconst
it)Peter Mandeljc
03/31/2022, 8:18 AMStrum355
03/31/2022, 9:29 AMPeter Mandeljc
03/31/2022, 9:52 AM