forked from go/golangs_learn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
287 B
20 lines
287 B
package main
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func PrintAll(vals []interface{}) {
|
|
for _, val := range vals {
|
|
fmt.Println(val)
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
names := []string{"stanley", "david", "oscar"}
|
|
vals := make([]interface{}, len(names))
|
|
for i, v := range names {
|
|
vals[i] = v
|
|
}
|
|
PrintAll(vals)
|
|
}
|
|
|