<How does kotlin compiler know whether a val shoul...
# stackoverflow
u
How does kotlin compiler know whether a val should be a property or a function The following kotlin code val nameHash get() = name.hashCode() can be compiled into java as follows public final int getNameHash() { return name.hashCode(); } and the property nameHash disapears. However when the val is changed to var, the compiler says "Property must be initialized" What is the deeper difference between var and val?