The way that functions like arrayOf() and listOf() work is because they accept a variable number of parameters. This is denoted by using the vararg keyword before the name of the parameter in the function. Then, callers of the function can pass an arbitrary number of values, which are accessed by the function as an array.

You can learn more about this in:
Run Edit