Need Assistance?

support@tutorialshub.in

Variables, Data Types & Operators

val (Read-Only) vs var (Mutable) & const val

ADVERTISEMENT
Kotlin Free Lesson
5 min read
ADVERTISEMENT

Kotlin encourages immutability by separating variable declarations clearly:

  • val (Value): Read-only reference—can be assigned once at runtime (like final in Java or const in JS). Always start with val!
  • var (Variable): Mutable reference—can be reassigned later.
  • const val: Compile-time constant (top-level or inside an object) for primitives and Strings.
ADVERTISEMENT
Hi, I'm Tuby! Here to help you