The Code A is from the article.
It' wrapped with with, I hope to convert it to a full code, how can I do?
BTW, Code B is wrong.
Code A
val pxValue = with(LocalDensity.current) { 16.dp.toPx() }
Code B
val s = LocalDensity.current
val pxValue=s.16.dp.toPx()
Add Content:
For example, the Code C is using with, I can write a full Code D instead of Code C without with.
Code C
data class Person(var name: String, var tutorial : String)
var person = Person("Anupam", "Kotlin")
with(person) {
name = "No Name"
tutorial = "Kotlin tutorials"
}
Code D
data class Person(var name: String, var tutorial : String)
var person = Person("Anupam", "Kotlin")
person.name = "No Name"
person.tutorial = "Kotlin tutorials"