setValue
Use a TVar using property delegation.
import arrow.fx.stm.TVar
import arrow.fx.stm.atomically
suspend fun main() {
//sampleStart
val tvar = TVar.new(10)
val result = atomically {
var x by tvar
x = 20
}
//sampleEnd
println(result)
}
Content copied to clipboard