Skip to content

Instantly share code, notes, and snippets.

@GabrielBrasileiro
Last active June 21, 2021 20:09
Show Gist options
  • Save GabrielBrasileiro/6e06c93f08e8beb14015ca1816968d80 to your computer and use it in GitHub Desktop.
Save GabrielBrasileiro/6e06c93f08e8beb14015ca1816968d80 to your computer and use it in GitHub Desktop.
HighOrderFunctionNoinline.kt
fun main() {
val descricao = "Inline te dando poderes mágicos"
val descricaoEmEscopoPrincipal = "Inline no escopo principal"
executarOperacao({
print(descricao)
return // Retorno permitido
}, {
print(descricaoEmEscopoPrincipal)
return // Retorno não permitido
})
}
inline fun executarOperacao(operacaoDois: () -> Unit, noinline operacaoQuatro: () -> Unit) {
operacaoUm()
operacaoDois()
operacaoTres()
operacaoQuatro()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment