hi, quick question; what's the difference betwee...
# getting-started
v
hi, quick question; what's the difference between
Copy code
val foo
  get() = expensiveOrAllocFunc()
vs
Copy code
val foo by lazy { expensiveOrAllocFunc() }
d
The first one calls the function every time you get
foo
. The 2nd one computes it only on first access and then keeps the same result.
🙏 2
👍 3