You can use with function from the Kotlin Standard library, e.g.:
with(theCustomer) {
name = "Coho Vineyard"
url = "http://www.cohovineyard.com/"
city = "Redmond"
}
with() returns some result. It makes code cleaner.
Also you can use apply extension function:
theCustomer.apply {
name = "Coho Vineyard"
url = "http://www.cohovineyard.com/"
city = "Redmond"
}
apply - declared on Any class, it could be invoked on instances of all types, it makes code more readable. Use when need to utilize an instance of the object (modify properties), express the chain of calls.
It differs from with() in that it returns Receiver.