function PrintSlice supports Generics
This commit is contained in:
parent
2f14d71c11
commit
e0721dde05
@ -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()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user