Last active
March 21, 2019 02:40
-
-
Save markstgodard/4e04f201a3ceaeb252614a76d193c78b to your computer and use it in GitHub Desktop.
addr.go (neg)
This file contains hidden or 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
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