Skip to content

Instantly share code, notes, and snippets.

@cioccarellia
Created July 28, 2020 15:33
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 cioccarellia/0b0db96a9eeec1d1854807edab91b951 to your computer and use it in GitHub Desktop.
Save cioccarellia/0b0db96a9eeec1d1854807edab91b951 to your computer and use it in GitHub Desktop.
/**
* Calls the specified function [block] and returns its result.
*/
public inline fun <R> run(block: () -> R): R {
return block()
}
/**
* Calls the specified function [block] with `this` value as its receiver and returns its result.
*/
public inline fun <T, R> T.run(block: T.() -> R): R {
return block()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment