function PrintSlice supports Generics

This commit is contained in:
machangxin 2022-12-17 14:59:21 +08:00
parent 2f14d71c11
commit e0721dde05

View File

@ -11,7 +11,8 @@ import (
"strings"
)
func PrintSlice(nums []int) {
// PrintSlice Print a slice
func PrintSlice[T any](nums []T) {
fmt.Printf("%v", nums)
fmt.Println()
}