Skip to content

Instantly share code, notes, and snippets.

View Pify's full-sized avatar

Rafif Rabbani Pify

  • Malang
View GitHub Profile
@Pify
Pify / CrossinlineExample.kt
Created September 15, 2021 11:49
crossinline use case, should be used to avoid non-local returns
fun doSomething() {
print("doSomething start")
doSomethingElse {
print("doSomethingElse")
}
print("doSomething end")
}
inline fun doSomethingElse(crossinline show: () -> Unit) {
show()
@Pify
Pify / InlineExample.kt
Created September 15, 2021 11:39
inline function use case
fun doSomething() {
print("doSomething start")
doSomethingElse()
print("doSomething end")
}
inline fun doSomethingElse() {
print("doSomethingElse")
}