Skip to content

Instantly share code, notes, and snippets.

@cyantarek
Last active June 19, 2018 14:39
Show Gist options
  • Save cyantarek/adfc73083629ab81863e74b43b2a9885 to your computer and use it in GitHub Desktop.
Save cyantarek/adfc73083629ab81863e74b43b2a9885 to your computer and use it in GitHub Desktop.
//calculator.go
package main
import "errors"
func main() {
}
func AddFunc(num ...int) (int, error) {
if len(num) == 0 {
return 0, errors.New("empty input")
}
var result int
for _, j := range num {
result += j
}
return result, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment