mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 21:24:53 +08:00
function PrintSlice supports Generics
This commit is contained in:
@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user