Created
July 24, 2018 10:23
-
-
Save jacksonfdam/d777158760867c69d736aa76b307d028 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
/** | |
* We declare a package-level function main which returns Unit and takes | |
* an Array of strings as a parameter. Note that semicolons are optional. | |
*/ | |
fun main(args: Array<String>) { | |
val funcaoDeSucesso = { nome:String -> | |
println(nome) | |
} | |
val funcaoDeFalha = { -> | |
println("Nao encontrado") | |
} | |
buscaNome(funcaoDeSucesso,funcaoDeFalha ) | |
} | |
fun buscaNome(sucesso: (String)->Unit,falha:()->Unit){ | |
if(true){ | |
sucesso("Maria") | |
} else { | |
falha() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://www.objgen.com/pojo