October 2019
Intermediate to advanced
434 pages
11h 54m
English
The vararg parameters are convenient, but they have some caveats:
Defining multiple vararg parameters will result in a compiler error, as in the following example:
// this will not compile// Error: "Multiple vararg-parameters are prohibited"fun helloFunctions(vararg nums: Int, greeting: String, vararg names: String) { ...}
It's generally a good idea to make a vararg parameter the last parameter in your function, especially if there are other arguments of the same type present. To illustrate why this is important, we can use the following helloFunctions example:
fun helloFunctions ...
Read now
Unlock full access