MCPcopy Index your code
hub / github.com/derekbanas/Go-Tutorial / getSum2

Function getSum2

hellogo.go:60–68  ·  view source on GitHub ↗

Variadic function

(nums ...int)

Source from the content-addressed store, hash-verified

58
59// Variadic function
60func getSum2(nums ...int) int {
61 sum := 0
62 // nums gets converted into a slice which is
63 // iterated by range (More on slices later)
64 for _, num := range nums {
65 sum += num
66 }
67 return sum
68}
69
70func getArraySum(arr []int) int {
71 sum := 0

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected