0
private var TodosAdapter by lazy{ TodosAdapter() }

This is my code and when i declare it like this, compiler throws an error that var should be changed to val

I am wondering when we declare it as val doesn't it change the value of TodosAdapter afterwards? I mean normally we can't change the value of variable declared as val. How this happens, can somebody explain what is working behind this

a_local_nobody
  • 7,947
  • 5
  • 29
  • 51
nasibeyyubov
  • 1,735
  • 3
  • 11
  • 28

0 Answers0