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

pull/7724/head
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
1 changed files with 6 additions and 0 deletions

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