0

Val in kotlin is a immutable one and Const also immuntable one.How they are differnt in programm....Explain me in a code

  • See https://stackoverflow.com/questions/37595936/what-is-the-difference-between-const-and-val – lukas.j Feb 28 '22 at 17:12
  • Please refer to the question linked in other comments for an answer to your question. Also, note that `val` does not mean immutable, it just means read-only (no setter for the property). Multiple accesses to the property could yield different values over time, because the state could be modified by other means (not just by setting the property) – Joffrey Feb 28 '22 at 17:40

1 Answers1

0

You can read the differences between them both in: https://www.geeksforgeeks.org/whats-the-difference-between-const-and-val-in-kotlin/