Last active
May 19, 2021 17:27
-
-
Save osama-raddad/3d12c2ceb5411ae71b47734c9ff4765f 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
https://github.com/rygelouv/LiteKoin | |
https://proandroiddev.com/lets-build-our-own-simplified-version-of-koin-19a887306258 | |
main() | |
fun main() { | |
val test = 1 | |
val squareFun = squareFun() | |
val xxx = squareFun() | |
val a = test.squareFun() | |
module2 { } | |
val ad = squareFun1 { | |
a | |
} | |
println(test.ad()) | |
} | |
fun module1(block: (Int) -> Unit) { | |
block(12) | |
} | |
fun module2(block: Int.() -> Unit) { | |
block(12) | |
12.block() | |
} | |
//val squareFun = fun Int.() = this * this | |
fun squareFun1(a: Int.() -> Int): Int.() -> Int { | |
// this * this | |
return a | |
} | |
fun squareFun(): Int.() -> Int { | |
// this * this | |
return fun Int.(): Int { | |
return this *this | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment