function PrintSlice supports Generics

pull/126/head
machangxin 2 years ago
parent 2f14d71c11
commit e0721dde05

@ -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()
}

Loading…
Cancel
Save