mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2024-12-25 14:28:58 +00:00
fix: variadic function
This commit is contained in:
parent
bf67e042e9
commit
252edd5485
@ -6,7 +6,7 @@
|
||||
|
||||
<u><i>gopl.io/ch5/sum</i></u>
|
||||
```Go
|
||||
func sum(vals...int) int {
|
||||
func sum(vals ...int) int {
|
||||
total := 0
|
||||
for _, val := range vals {
|
||||
total += val
|
||||
|
Loading…
Reference in New Issue
Block a user