Skip to content

Instantly share code, notes, and snippets.

@s1monw1
Last active Sep 18, 2022
Embed
What would you like to do?
// Defines a variable named `greet` of type `String.() -> Unit`.
// This is a function literal with receiver type in which the receiver is of type `String`
var greet: String.() -> Unit = { println("Hello $this, your name contains $length letters.") }
@MexieAndCo
Copy link

MexieAndCo commented Sep 18, 2022

This is great stuff (I'm teaching myself Kotlin).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment