第36节 Go语言细节

❤️💕💕Go语言高级篇章,在此之前建议您先了解基础和进阶篇。Myblog:http://nsddd.topopen in new window

Go语言基础篇open in new window

Go语言100篇进阶open in new window


[TOC]

Go语言命令

  • go vat:静态检测

Go语言全部都是值传递,所以不会改变值。

mySlice := []int{10,20,30,40,50}

// It doesn't change the slice value
for _,value := range mySlice {
	value *= 2 
}

// It can change the slice value
for index,_ := range mySlice {
    mySlice[index] *= 2
}

指针传参固定写法:

func main() {

    para := Paramenter{name: "aaa"}
    changeParament(&para)
}

func changeParament(para *Paramenter,value string) {
    para.name = value
}

END 链接