Last active
February 8, 2019 08:33
-
-
Save renaudcerrato/45fd0f7af65e1b2f11f0a70a98873e72 to your computer and use it in GitHub Desktop.
Kotlin vararg
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
fun hello(vararg values: String) { | |
for(value in values) println("Hello $value!") | |
} | |
hello("Kotlin", "Java", "Groovy") | |
// calls using the spread operator | |
val names = arrayOf("Java", "Groovy") | |
hello(*names) | |
hello("Kotlin", *names) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment