summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..947d028
--- /dev/null
+++ b/main.go
@@ -0,0 +1,11 @@
+package demo
+
+import "golang.org/x/exp/constraints"
+
+type Number interface {
+ constraints.Integer | constraints.Float
+}
+
+func Add[T Number](a, b T) T {
+ return a + b
+}