Last active
May 5, 2020 09:40
-
-
Save sagarpatel288/1befa2159b6ed4571eb83137783fedfb to your computer and use it in GitHub Desktop.
Passing a function literal that has only one parameter (function literal syntax/ signature 2)
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
/** | |
* While calling the higher order function When the function type parameter is one and only parameter, | |
* and if the function type has also one and only parameter, | |
* in addition to function call parentheses, we can also omit the parameter of the function type and an arrow ```->``` | |
* We just write core business logic between curly braces | |
* and we can access our single parameter through the keyword it like below: | |
*/ | |
doSomething { "$it" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment