You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

14 lines
205 B

package main
func main() {
println("add:", Add(3, 5))
println("add:", Add(int8(3), 5))
}
type Integer interface {
int | int8 | int16 | int32 | int64
}
func Add[T Integer](a, b T) T {
return a + b
}