Skip to content

Commit 53403bd

Browse files
feat: solution for exercise 13_variadic (#117)
1 parent c219db1 commit 53403bd

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package variadic
2+
3+
// Sum returns the sum of any number of integers
4+
func Sum(nums ...int) int {
5+
total := 0
6+
for _, num := range nums {
7+
total += num
8+
}
9+
return total
10+
}

0 commit comments

Comments
 (0)