1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

docs: add example of using array decomposition (#7720)

This commit is contained in:
StunxFS 2020-12-30 15:44:19 -04:00 committed by GitHub
parent 8724749728
commit bbda30b816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,6 +210,12 @@ fn sum(a ...int) int {
println(sum()) // Output: 0
println(sum(1)) // 1
println(sum(2,3)) // 5
// using array decomposition
a := [2,3,4]
println(sum(a...)) // <-- using postfix ... here. output: 9
b := [5, 6, 7]
println(sum(b...)) // output: 18
```
## Symbol visibility