Merge pull request #82 from Hongbo-Miao/patch-1

fix: variadic function
This commit is contained in:
Xargin 2020-03-21 22:02:48 +08:00 committed by GitHub
commit b09d03dc2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@
<u><i>gopl.io/ch5/sum</i></u> <u><i>gopl.io/ch5/sum</i></u>
```Go ```Go
func sum(vals...int) int { func sum(vals ...int) int {
total := 0 total := 0
for _, val := range vals { for _, val := range vals {
total += val total += val