Skip to content

Commit

Permalink
Moved to v2 folder
Browse files Browse the repository at this point in the history
  • Loading branch information
clheikes committed Feb 8, 2024
1 parent ade0a43 commit 0725a66
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions v2/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/clheikes/addition

go 1.21.4

require golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3
2 changes: 2 additions & 0 deletions v2/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 h1:/RIbNt/Zr7rVhIkQhooTxCxFcdWLGIKnZA4IXNFSrvo=
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
17 changes: 17 additions & 0 deletions v2/lib.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Package addition provides a function for adding two integers
package addition

import "golang.org/x/exp/constraints"

type Number interface {
constraints.Float | constraints.Integer
}

// Add takes two integers and adds them together.
//
// It has two parameters: both parameters are integers, Add returns the sum of the
// two integer parameters
// [Addition](https://www.mathsisfun.com/numbers/addition.html)
func Add[T Number](a, b T) T {
return a + b
}

0 comments on commit 0725a66

Please sign in to comment.