mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-04 22:28:40 +08:00
function PrintSlice supports Generics
This commit is contained in:
@ -11,7 +11,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func PrintSlice(nums []int) {
|
// PrintSlice Print a slice
|
||||||
|
func PrintSlice[T any](nums []T) {
|
||||||
fmt.Printf("%v", nums)
|
fmt.Printf("%v", nums)
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user