Skip to content

Instantly share code, notes, and snippets.

@sagarpatel288
Created April 23, 2020 12:26
Show Gist options
  • Save sagarpatel288/5cbff4108cd2feacce2d090711a11ecd to your computer and use it in GitHub Desktop.
Save sagarpatel288/5cbff4108cd2feacce2d090711a11ecd to your computer and use it in GitHub Desktop.
Function type as a parameter in a higher order function
fun doSomething(a: Int, b: Int, ft: (Int, Int) -> Int): String {
val result = ft(a, b) //OR ft.invoke(a, b)
return “doSomething: ” + result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment