I just started learning Kotlin and could not get one thing:
I have a variable that is based on some other variables (for example "A" and "B"). Is there an easy way to recalculate the resulted variable after i change var "A" or "B"? As i understood, i can just repeat the code for "result" again, but is there an easier way? i think in some cases the code could be quite long...
Example is below:
var valueA = 9
var valueB = 10
var result = valueA*valueB
println(result)
valueA = 15
"A" is changed, but if i write "println(result)" right now, var "result" will not be recalculated and will stay = 90
result = valueA*valueB
println(result)
only after i write the same code for "result" again, the output is recalculated