-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
16 additions
and
4 deletions.
There are no files selected for viewing
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
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 |
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
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 |