Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun main(args: Array<String>) {
- val str = "I am a string"
- str.run {
- // no lambda params, receiver is value type (String), returns Unit.
- }
- str.let {
- // lambda params are value type (String), no receiver, returns Unit.
- }
- str.apply {
- // no lambda params, receiver is value type (String), returns value type (String).
- }
- str.also {
- // lambda params are value type (String), no receiver, returns value type (String).
- }
- with(str) {
- // no lambda params, receiver is value type (String), returns Unit,
- // it does NOT an extension function though the receiver will be defined as a parameter.
- }
- }
Add Comment
Please, Sign In to add comment