Skip to content

Instantly share code, notes, and snippets.

@Imater
Created August 25, 2014 15:35
Show Gist options
  • Save Imater/f7db8f1c2e0afa7a6324 to your computer and use it in GitHub Desktop.
Save Imater/f7db8f1c2e0afa7a6324 to your computer and use it in GitHub Desktop.
varradic multiply arguments
package main
import "fmt"
func add(a ...int) int {
sum := 0
for _, num := range a {
sum += num
}
return sum
}
func main() {
fmt.Println(add(2,3,4,5,6))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment