This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var userResponse = ... | |
| with(userResponse) { | |
| // Do something | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data class User(var name: String) { | |
| var age = 0 | |
| var job = "-" | |
| var company = "-" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val user = User("Akexorcist").also { | |
| it.age = 17 | |
| val message = it.name += " is awesome" | |
| ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val user = User("Akexorcist").apply { | |
| age = 17 | |
| company = name += " Company" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val user = User("Akexorcist").apply { | |
| this.age = 17 | |
| this.company = this.name + " Company" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val user = User("Akexorcist") | |
| val updatedUser = user.apply { | |
| job = "Android Developer" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // user | |
| User(name = "Akexorcist", | |
| age = 0, | |
| job = "Android Developer", | |
| company = "-") | |
| // updatedUser | |
| User(name = "Akexorcist", | |
| age = 0, | |
| job = "Android Developer", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val user = User("Akexorcist") | |
| val followerCount = user.run { | |
| ... | |
| getUserFollowerCount(name) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // user | |
| User(name = "Akexorcist", | |
| age = 0, | |
| job = "Android Developer", | |
| company = "-") | |
| // followerCount | |
| 128 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val user = User("Akexorcist").run { | |
| ... | |
| doSomethingWithoutAnyReturn() | |
| } |