Skip to content

Commit

Permalink
add new pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
jpillora committed Jul 17, 2020
1 parent bf95e1c commit e9400c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions math.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package math

//Add two numbers return special type
func Add(a, b int) Num { return Num(a + b) }
import "github.com/jpillora/gocompat/newmath"

//Num is an int
type Num int
var Add = newmath.Add

type Num = newmath.Num
12 changes: 12 additions & 0 deletions newmath/new_math.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package newmath

//Add two numbers
func Add(a, b int) Num {
//double swap!
a, b = b, a
a, b = b, a
return Num(a + b)
}

//Num is an int
type Num int

0 comments on commit e9400c2

Please sign in to comment.