2019-10-10 18:58:14 +03:00
|
|
|
## Variable Argument Lists (#2)
|
2019-07-15 17:01:04 +03:00
|
|
|
|
2019-10-21 15:37:24 +03:00
|
|
|
Write a function `printArgs()` with a `String` as the first parameter, and a
|
2020-04-28 23:39:10 +03:00
|
|
|
`vararg` parameter of `Int` as the second parameter. `printArgs()` displays its
|
2020-10-12 01:37:25 +03:00
|
|
|
arguments on the console: first the `String`, then the `Int`s, separated by
|
2020-04-28 23:39:10 +03:00
|
|
|
commas and surrounded by square brackets.
|
2019-10-14 17:49:27 +03:00
|
|
|
|
2019-10-21 15:37:24 +03:00
|
|
|
For example, the output for `printArgs("Numbers: ", 1, 2, 3)` should be:
|
|
|
|
|
|
|
|
```
|
|
|
|
Numbers: [1, 2, 3]
|
|
|
|
```
|
|
|
|
|
|
|
|
<div class="hint">
|
|
|
|
|
2020-04-28 23:39:10 +03:00
|
|
|
Use `toList()` on the `vararg` parameter to get the requested `String`
|
|
|
|
representation.
|
2019-10-21 15:37:24 +03:00
|
|
|
|
2020-10-12 01:37:25 +03:00
|
|
|
</div>
|