package main
import "fmt"
func test(s ...string){ //多参数,可以使用切片访问 s[]
fmt.Println(s[0])
// echo D
fmt.Println(s)
// echo [D e m o go]
}
func main(){
test("D","e","m","o","go")
}
package main
import "fmt"
func test(s ...string){ //多参数,可以使用切片访问 s[]
fmt.Println(s[0])
// echo D
fmt.Println(s)
// echo [D e m o go]
}
func main(){
test("D","e","m","o","go")
}
转载于:https://my.oschina.net/u/3529405/blog/1614110