Skip to content

Instantly share code, notes, and snippets.

@osama-raddad
Last active May 19, 2021 17:27
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 osama-raddad/3d12c2ceb5411ae71b47734c9ff4765f to your computer and use it in GitHub Desktop.
Save osama-raddad/3d12c2ceb5411ae71b47734c9ff4765f to your computer and use it in GitHub Desktop.
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