Skip to content

Instantly share code, notes, and snippets.

@s1monw1
Last active September 18, 2022 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s1monw1/2f71c233a7e47e70c813057aceb69487 to your computer and use it in GitHub Desktop.
Save s1monw1/2f71c233a7e47e70c813057aceb69487 to your computer and use it in GitHub Desktop.
// 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

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