Skip to content

Instantly share code, notes, and snippets.

@emregoren
Created February 14, 2020 12:55
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 emregoren/d499021dd45ade4cbe9a82216fe95bfc to your computer and use it in GitHub Desktop.
Save emregoren/d499021dd45ade4cbe9a82216fe95bfc to your computer and use it in GitHub Desktop.
fun main() {
val higherOrderFunction = { surName: String -> "surName : $surName" }
val anonymousFunction = fun(surName: String): String { return "surName : $surName" }
printUserInfo("EMRE", higherOrderFunction, 20)
printUserInfo("EMRE", anonymousFunction, 20)
printUserInfo("EMRE", fun(surName: String): String {
return "surName : $surName"
}, 20)
}
fun printUserInfo(name: String, getSurName: (surName: String) -> String = { "" }, age: Int): Unit {
println("name: $name , age : $age")
println(getSurName("GÖREN"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment