As broot says, adding get() changes the meaning very significantly.
Without the get(), you're declaring a property with an initial value. For example:
class SomeClass {
var prop = initialisingFunction()
}
That's roughly equivalent to:
class SomeClass {
var prop: Int
init {
prop = initialisingFunction()
}
}
So initialisingFunction() is called only once, during construction, and the class stores its value in a backing field after that. If the property is a var, as here, then the value can be changed after that.
But with the get(), you're declaring a property with a custom getter:
class SomeClass {
val prop
get() = initialisingFunction()
}
That's even more roughly equivalent to:
class SomeClass {
fun getProp() = initialisingFunction()
}
Here, there's no backing field to store the property; every time you get its value, it will call initialisingFunction() and hand you that value directly.
If the property is a var, then you'll also need a custom setter. (Otherwise, the default one would cause a backing field to be created, which it would set, but whose value you'd never see…)
Which version to use will depend on your needs. If the property needs to change in line with something external, then a custom getter is probably needed. It can also be a slightly memory saving if you need to return a value that's the same for all instance of the class. But if calculating the value is expensive, and/or if it's different for each instance, especially if it needs to be mutable, then you'll probably need a property with an initialiser.