Last active
June 19, 2018 14:39
-
-
Save cyantarek/adfc73083629ab81863e74b43b2a9885 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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