Last active
February 3, 2021 15:00
-
-
Save JH108/8b29e5674dc974c16ae913953d36ea77 to your computer and use it in GitHub Desktop.
Random Kotlin Code
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
import kotlinx.coroutines.* | |
import kotlinx.coroutines.channels.* | |
import kotlinx.coroutines.selects.* | |
import java.text.* | |
import java.util.* | |
// Define variables | |
val names = arrayOf("What", "Even", "is", "this🤯") | |
val longName = "Some random function name" | |
// Use a variable as a function name | |
fun `$longName`() { | |
println("I cannot believe that this is a thing!") | |
} | |
fun main() { | |
names.forEach { | |
// Use more variables as function names so we can dynamically name functions 🤯 | |
fun `$it`(thing: String) { | |
println("UnB $thing") | |
} | |
`$it`(it) | |
} | |
`$longName`() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment