Skip to content

Instantly share code, notes, and snippets.

@markstgodard
Last active March 21, 2019 02:40
Show Gist options
  • Save markstgodard/4e04f201a3ceaeb252614a76d193c78b to your computer and use it in GitHub Desktop.
Save markstgodard/4e04f201a3ceaeb252614a76d193c78b to your computer and use it in GitHub Desktop.
addr.go (neg)
package adder
import "errors"
var ErrInvalidSummand = errors.New("Invalid summand")
func Add(x, y int) (int, error) {
if x <= 0 || y <= 0 {
return 0, ErrInvalidSummand
}
return x + y, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment