Using (val) and (const val) in Kotlin - devrath/KotlinAlchemy GitHub Wiki
             Usage of val in kotlin
- We use valto declare read-only data in kotlin.
- It is also called assign oncevalues.
- You should always strive to use valto avoidside-effectsin kotlin that would lead to bugs.
Usage of const val in kotlin
- We use const valto declare the constants in kotlin.
- If we have a value that never changes and the value is known at compile time, we should strive to use const val.
- We can add only primitive typeorstringsin theconst val.
- const valin kotlin is equivalent to- static finalin Java.
Why is there a possible need for (const val) when you can use just (val)
- Using the const valhelps the compiler to do optimizations during the compile time itself.
- Also it's good to know that there is a value that does not change even during the runtime.