What is the best way to access a dynamic value like an array size inside a class? In Java, I would create a getSize() function that would return the size of the array. In Kotlin, there are two ways of doing this:
// One solution val size get() = myArray.size // Another solution fun size() = myArray.size
Is one method preferable than the other?