Created
July 28, 2020 15:33
-
-
Save cioccarellia/0b0db96a9eeec1d1854807edab91b951 to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* 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