daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Mar 26th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package adder
  2.  
  3. import "errors"
  4.  
  5. var ErrInvalidSummand = errors.New("Invalid summand")
  6.  
  7. func Add(x, y int) (int, error) {
  8.     if x <= 0 || y <= 0 {
  9.         return 0, ErrInvalidSummand
  10.     }
  11.     return x + y, nil
  12. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top