1
1
Fork 0
AtomicKotlinCourse/Introduction to Objects/Variable Argument Lists/Exercise 2/task.md

20 lines
526 B
Markdown
Raw Normal View History

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